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

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

Issue 1240573007: Make it possible to detect PopupMenuItem presses (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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/popup_menu_item.dart
diff --git a/sky/sdk/lib/widgets/popup_menu_item.dart b/sky/sdk/lib/widgets/popup_menu_item.dart
index 9888d4e296a3b35b06b0b0637b93de6be22a6827..d04e3266a405f2d0bf9ca5b9f9527532a858fb5b 100644
--- a/sky/sdk/lib/widgets/popup_menu_item.dart
+++ b/sky/sdk/lib/widgets/popup_menu_item.dart
@@ -12,16 +12,23 @@ const double kMenuItemHeight = 48.0;
const double kBaselineOffsetFromBottom = 20.0;
class PopupMenuItem extends Component {
- PopupMenuItem({ String key, this.child, this.opacity}) : super(key: key);
+ PopupMenuItem({
+ String key,
+ this.onPressed,
+ this.child
+ }) : super(key: key);
final Widget child;
- final double opacity;
+ final Function onPressed;
TextStyle get textStyle => Theme.of(this).text.subhead;
Widget build() {
- return new Opacity(
- opacity: opacity,
+ return new Listener(
+ onGestureTap: (_) {
+ if (onPressed != null)
+ onPressed();
+ },
child: new InkWell(
child: new Container(
height: kMenuItemHeight,
« sky/sdk/example/stocks/lib/stock_menu.dart ('K') | « sky/sdk/lib/widgets/popup_menu.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698