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
| PopupMenuButton<String>( shape: RoundedRectangleBorder(side: BorderSide(color: Colors.red), borderRadius: BorderRadius.circular(20)), offset: Offset(0, 30), elevation: 5, padding: EdgeInsets.all(5), //color: Colors.grey, child: RaisedButton(child: Text('学科'),), //icon: Icon(Icons.add), initialValue: '语文', tooltip: 'PopupMenuButton', onSelected: (value) { print('$value'); }, onCanceled: () { print('onCanceled'); }, itemBuilder: (context) { return <PopupMenuEntry<String>>[ PopupMenuItem<String>( value: '语文', child: Text('语文'), ), PopupMenuDivider(height: 20,), PopupMenuItem<String>( value: '数学', enabled: false, child: Text('数学',style: TextStyle(color: Colors.red),), ), PopupMenuDivider(), PopupMenuItem<String>( value: '英语', child: Text('英语'), ), PopupMenuDivider(), PopupMenuItem<String>( value: '生物', child: Text('生物'), ), PopupMenuDivider(), PopupMenuItem<String>( value: '化学', child: Text('化学'), ), ]; }, )
|