@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
)
)
)
);
});
}
)
)
);
“我之前编写过具有相同底部表用户界面的代码,您可以更新它”
Future _selectImage(BuildContext context) 异步 { 等待 showModalBottomSheet( 背景颜色:颜色.透明, 上下文:上下文, 形状:const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(顶部: Radius.circular(20)), ), 构建器:(BuildContext 上下文){ 返回容器( 填充:const EdgeInsets.all(15), 子项:列( mainAxisSize:MainAxisSize.min, 孩子们: [ 卡片( 颜色: Colors.grey.shade200, 子项:列( 孩子们: [ 填充( 填充:const EdgeInsets.all(10.0), 孩子:文本( '将视频上传到您的工作区', 样式:文本样式( 字体大小:17,颜色:Colors.grey.shade500), ), ), 常量除法器(), 列表图块( 标题:中心( 孩子:常量文本( '拍个照', 样式:文本样式( 颜色: 颜色.蓝色, 字体大小:17, ), ), ), onTap: () 异步 { 导航器.pop(上下文); Uint8List?文件=等待pickImage(ImageSource.camera); 如果(文件!=空){ 设置状态((){ _文件=文件; _isImageFullscreen = false; }); } }, ), 除法器(), 列表图块( 标题: 填充( 填充:const EdgeInsets.all(8.0), 孩子:中心( 孩子:常量文本( '从画廊中选择', 样式:文本样式( 颜色: 颜色.蓝色, 字体大小:17, ), ), ), ), onTap: () 异步 { 导航器.pop(上下文); Uint8List?文件=等待pickImage(ImageSource.gallery); 如果(文件!=空){ 设置状态((){ _文件=文件; _isImageFullscreen = false; }); } }, ), ], ), ), SizedBox(height: 10), // 在卡片之间添加一些空间 卡片( 颜色: Colors.grey.shade200, 子项:ListTile( 标题:中心( 孩子:常量文本( '取消', 样式:文本样式( 颜色: 颜色.蓝色, 字体大小:17, ), ), ), 点击: () { 导航器.pop(上下文); }, ), ), ], ), ); }, ); }