Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: sky/sdk/lib/framework/components2/floating_action_button.dart

Issue 1156383004: Add the floating action button to stocks2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/stocks2/lib/stock_app.dart ('k') | sky/sdk/lib/framework/components2/radio.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/components2/floating_action_button.dart
diff --git a/sky/sdk/lib/framework/components2/floating_action_button.dart b/sky/sdk/lib/framework/components2/floating_action_button.dart
index 711ae1887055b652da4b753a83051a5e3f635132..e4beed8b3c508a43ff8a5d62d930664146fcd698 100644
--- a/sky/sdk/lib/framework/components2/floating_action_button.dart
+++ b/sky/sdk/lib/framework/components2/floating_action_button.dart
@@ -3,29 +3,15 @@
// found in the LICENSE file.
import '../fn2.dart';
-import '../theme/colors.dart';
+import '../rendering/box.dart';
+import '../theme2/colors.dart';
+import 'dart:sky' as sky;
import 'ink_well.dart';
import 'material.dart';
-class FloatingActionButton extends Component {
- // TODO(abarth): We need a better way to become a container for absolutely
- // positioned elements.
- static final Style _style = new Style('''
- width: 56px;
- height: 56px;
- background-color: ${Red[500]};
- border-radius: 28px;'''
- );
- static final Style _clipStyle = new Style('''
- position: absolute;
- justify-content: center;
- align-items: center;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- -webkit-clip-path: circle(28px at center);''');
+const double _kSize = 56.0;
+class FloatingActionButton extends Component {
UINode content;
int level;
@@ -39,9 +25,14 @@ class FloatingActionButton extends Component {
children.add(content);
return new Material(
- content: new Container(
- style: _style,
- children: [new StyleNode(new InkWell(children: children), _clipStyle)]),
+ content: new CustomPaint(
+ callback: (sky.Canvas canvas) {
+ const double radius = _kSize / 2.0;
+ canvas.drawCircle(radius, radius, radius, new sky.Paint()..color = Red[500]);
+ },
+ child: new Container(
+ desiredSize: const sky.Size(_kSize, _kSize),
+ child: new InkWell(children: children))),
level: level);
}
}
« no previous file with comments | « sky/examples/stocks2/lib/stock_app.dart ('k') | sky/sdk/lib/framework/components2/radio.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698