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

Unified Diff: sky/sdk/lib/widgets/floating_action_button.dart

Issue 1188993003: Use semantic names for callbacks instead of onGestureTap (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_settings.dart ('k') | sky/sdk/lib/widgets/icon_button.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))
+ )
+ )
+ )
);
}
« no previous file with comments | « sky/examples/stocks2/lib/stock_settings.dart ('k') | sky/sdk/lib/widgets/icon_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698