https://github.com/fluttercandies/w_popup_menu
https://github.com/wanglu1209/WFlutterDemo
onTap: () async {
final result = await showMenu(
context: context,
position: RelativeRect.fromLTRB(100.0, 200.0, 100.0, 100.0),
// position: RelativeRect.fromLTRB(1000.0, 1000.0, 0.0, 10.0),
items: <PopupMenuItem<String>>[
new PopupMenuItem<String>( value: 'value01', child: new Text('Item One')),
new PopupMenuItem<String>( value: 'value02', child: new Text('Item Two')),
new PopupMenuItem<String>( value: 'value03', child: new Text('Item Three')),
new PopupMenuItem<String>( value: 'value04', child: new Text('I am Item Four'))
] );
},
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
title: Text('PopMenuDemo'),
actions: <Widget>[_NomalPopMenu()],
),
body: Center(child: new Text(_bodyStr)));
}
Widget _NomalPopMenu() {
return new PopupMenuButton<String>(
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
new PopupMenuItem<String>(
value: 'value01', child: new Text('Item One')),
new PopupMenuItem<String>(
value: 'value02', child: new Text('Item Two')),
new PopupMenuItem<String>(
value: 'value03', child: new Text('Item Three')),
new PopupMenuItem<String>(
value: 'value04', child: new Text('I am Item Four'))
],
onSelected: (String value) {
setState(() { _bodyStr = value; });
});
}