我正在使用 Scaffold 小部件,但是在打开底部对话框时出现此异常
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Calendar"),
),
body: SafeArea(
.......
.......
child: GestureDetector(
onTap: (){
//getting exception here
showBottomSheet(
context: context,
builder: (context) => Container(
color: Colors.red,
));
},
我被困在这段代码上,如果有人可以提出任何建议,那将非常有帮助。谢谢你。
最佳答案
使用showModalBottomSheet
而不是 showBottomSheet
试用以下例如。
void _settingModalBottomSheet(BuildContext context){
showModalBottomSheet(
context: context,
builder: (BuildContext bc){
return Container(
child: new Wrap(
children: <Widget>[
new ListTile(
leading: new Icon(Icons.music_note),
title: new Text('Music'),
onTap: () => {}
),
new ListTile(
leading: new Icon(Icons.videocam),
title: new Text('Video'),
onTap: () => {},
),
],
),
);
});
}
关于android - 找不到脚手架小部件 : Getting exception while opening Bottom Dialog sheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60071855/