-
Notifications
You must be signed in to change notification settings - Fork 188
/
popup_menu_button_page.dart
59 lines (54 loc) · 1.67 KB
/
popup_menu_button_page.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import 'package:flutter/material.dart';
class PopupMenuButtonPage extends StatefulWidget {
@override
_PopupMenuButtonPageState createState() => _PopupMenuButtonPageState();
}
class _PopupMenuButtonPageState extends State<PopupMenuButtonPage> {
WhyFarther _selection;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('PopupMenuButtonPage'),
actions: <Widget>[
Theme(
data: ThemeData(cardColor: Colors.red),
child: PopupMenuButton<WhyFarther>(
onSelected: (WhyFarther result) {
setState(() {
_selection = result;
});
},
icon: Icon(Icons.more_vert),
itemBuilder: (BuildContext context) => <PopupMenuEntry<WhyFarther>>[
const PopupMenuItem<WhyFarther>(
value: WhyFarther.harder,
child: Text('Working a lot harder'),
),
const PopupMenuItem<WhyFarther>(
value: WhyFarther.smarter,
child: Text('Being a lot smarter'),
),
const PopupMenuItem<WhyFarther>(
value: WhyFarther.selfStarter,
child: Text('Being a self-starter'),
),
const PopupMenuItem<WhyFarther>(
value: WhyFarther.tradingCharter,
child: Text('Placed in charge of trading charter'),
),
],
),
),
],
),
body: Container(),
);
}
}
enum WhyFarther {
harder,
smarter,
selfStarter,
tradingCharter,
}