底部菜单选项

时间:2018-08-19 05:07:06

标签: material-design flutter material-ui flutter-layout

如何在Flutter中实现简单的底部菜单?我想显示一定数量的菜单项,并对点击做出适当的响应。我在gallery

中找不到任何东西

这是我尝试实现的示例,其中包含自定义选项(不仅仅是媒体选项)

enter image description here

1 个答案:

答案 0 :(得分:1)

也许这可以帮助https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart

@override
 Widget build(BuildContext context) {
 return new Scaffold(
  appBar: new AppBar(title: const Text('Modal bottom sheet')),
  body: new Center(
    child: new RaisedButton(
      child: const Text('SHOW BOTTOM SHEET'),
      onPressed: () {
        showModalBottomSheet<void>(context: context, builder: (BuildContext context) 
         {
          return new Container(
            child: new Padding(
              padding: const EdgeInsets.all(32.0),
              child: ListView(
               children: <Widget>[
                 ListTile(title: Text('Map'),onTap:null),//handle on tap here
                 //build other menu here
                 ],
              );
                )
                textAlign: TextAlign.center,
                style: new TextStyle(
                  color: Theme.of(context).accentColor,
                  fontSize: 24.0
                )
              )
            )
          );
        });
      }
    )
  )
);