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

Unified Diff: sky/sdk/lib/widgets/menu_item.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
Index: sky/sdk/lib/widgets/menu_item.dart
diff --git a/sky/sdk/lib/widgets/menu_item.dart b/sky/sdk/lib/widgets/menu_item.dart
index 1768a311314ba9ca1c742dd566be95b893b6068b..f376e6b2ee13449ba88387642b127354339e118e 100644
--- a/sky/sdk/lib/widgets/menu_item.dart
+++ b/sky/sdk/lib/widgets/menu_item.dart
@@ -23,42 +23,45 @@ const BoxDecoration _kHighlightBoring = const BoxDecoration(
);
class MenuItem extends ButtonBase {
- MenuItem({ String key, this.icon, this.children, this.onGestureTap })
+ MenuItem({ String key, this.icon, this.children, this.onPressed })
: super(key: key);
String icon;
List<Widget> children;
- GestureEventListener onGestureTap;
+ Function onPressed;
void syncFields(MenuItem source) {
icon = source.icon;
children = source.children;
- onGestureTap = source.onGestureTap;
+ onPressed = source.onPressed;
super.syncFields(source);
}
Widget buildContent() {
return new Listener(
+ onGestureTap: (_) {
+ if (onPressed != null)
+ onPressed();
+ },
child: new Container(
+ height: 48.0,
+ decoration: highlight ? _kHighlightDecoration : _kHighlightBoring,
child: new InkWell(
child: new Flex([
new Padding(
- child: new Icon(type: "${icon}_grey600", size: 24),
- padding: const EdgeDims.symmetric(horizontal: 16.0)
+ padding: const EdgeDims.symmetric(horizontal: 16.0),
+ child: new Icon(type: "${icon}_grey600", size: 24)
),
new Flexible(
+ flex: 1,
child: new Padding(
- child: new Flex(children, direction: FlexDirection.horizontal),
padding: const EdgeDims.symmetric(horizontal: 16.0)
- ),
- flex: 1
+ child: new Flex(children, direction: FlexDirection.horizontal),
+ )
)
])
- ),
- height: 48.0,
- decoration: highlight ? _kHighlightDecoration : _kHighlightBoring
- ),
- onGestureTap: onGestureTap
+ )
+ )
);
}
}

Powered by Google App Engine
This is Rietveld 408576698