gpt4 book ai didi

android - 找不到脚手架小部件 : Getting exception while opening Bottom Dialog sheet

转载 作者:行者123 更新时间:2023-12-03 10:11:27 26 4
gpt4 key购买 nike

我正在使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com