Index: sky/sdk/lib/widgets/floating_action_button.dart |
diff --git a/sky/sdk/lib/widgets/floating_action_button.dart b/sky/sdk/lib/widgets/floating_action_button.dart |
index 7f1e1822c5e9179947918f70d91353078e8f06c6..4218ed73eb8e7f303278f0f35c0c2ba4ee3ddd86 100644 |
--- a/sky/sdk/lib/widgets/floating_action_button.dart |
+++ b/sky/sdk/lib/widgets/floating_action_button.dart |
@@ -15,22 +15,41 @@ const double _kSize = 56.0; |
class FloatingActionButton extends ButtonBase { |
- FloatingActionButton({ String key, this.child }) : super(key: key); |
+ FloatingActionButton({ |
+ String key, |
+ this.child, |
+ this.enabled: true, |
Hixie
2015/06/17 22:59:21
either remove this or make it affect the UI
abarth-chromium
2015/06/17 23:04:04
Removed.
|
+ Function onPressed |
+ }) : super(key: key); |
- final Widget child; |
+ bool enabled; |
+ Widget child; |
+ Function onPressed; |
+ |
+ void syncFields(FloatingActionButton source) { |
+ enabled = source.enabled; |
+ child = source.child; |
+ onPressed = source.onPressed; |
+ } |
Hixie
2015/06/17 22:59:21
call the superclass.
abarth-chromium
2015/06/17 23:04:04
Done.
|
Widget buildContent() { |
return new Material( |
- child: new ClipOval( |
- child: new Container( |
- width: _kSize, |
- height: _kSize, |
- child: new InkWell(child: new Center(child: child)) |
- ) |
- ), |
color: Red[500], |
edge: MaterialEdge.circle, |
- level: highlight ? 3 : 2 |
+ level: highlight ? 3 : 2, |
+ child: new ClipOval( |
+ child: new Listener( |
+ onGestureTap: (_) { |
+ if (onPressed != null && enabled) |
+ onPressed(); |
+ }, |
+ child: new Container( |
+ width: _kSize, |
+ height: _kSize, |
+ child: new InkWell(child: new Center(child: child)) |
+ ) |
+ ) |
+ ) |
); |
} |