如何在用户关闭ModalBottomSheet时执行一段代码?showModalBottomSheet(context:context,builder:(BuildContextcontext){returnnewMusicR();},) 最佳答案 您可以将您的showModalBottomSheet分配给Future。将会发生的是,用户将触发模式表上的关闭操作并触发对您的future变量的then回调。例子:FuturebottomSheetAwaitClose=showModalBottomSheet(context:conte
如何在用户关闭ModalBottomSheet时执行一段代码?showModalBottomSheet(context:context,builder:(BuildContextcontext){returnnewMusicR();},) 最佳答案 您可以将您的showModalBottomSheet分配给Future。将会发生的是,用户将触发模式表上的关闭操作并触发对您的future变量的then回调。例子:FuturebottomSheetAwaitClose=showModalBottomSheet(context:conte
我有一个模态底页,我想在其中放置扩展列表。为此,我创建了一个类来为我的ExpansionPanelList创建项目。classFilterItem{boolisExpanded;finalStringheader;finalWidgetbody;FilterItem(this.isExpanded,this.header,this.body);}我只是为每个项目提供isExpandedbool值来判断它最初是否展开,ExpansionPanel的标题(按预期工作)和扩展面板。我有一个这样的项目列表:items=[newFilterItem(false,'BitSize',GridVie
在myApp()的主屏幕上我有一个无状态的小部件,它包含一个MaterialApp和一个Scaffold.脚手架的属性为drawer然后我创建了一个抽屉,抽屉中的其中一件元素需要打开showModalBottomSheet同时关闭drawer.我怎样才能做到这一点?我试过通过context本身,并作为globalKey.currentContext(在GlobalKeyglobalKey=GlobalKey();之后)但抽屉有时会关闭,其他时候会给我一个NoMethodFoundException(或类似的东西)简而言之,如何拥有Scaffolddrawer具有其中一项的,点击时关闭d
我想创建一个允许我设置高度和边框的自定义模式,我已经有了这个。home.dartbody:Center(child:RaisedButton(child:Text('Open'),onPressed:(){showModalBottomSheet(context:context,builder:(BuildContextcontext){returnHomeModal();});}),),home_modal.dartWidgetbuild(BuildContextcontext){returnContainer(color:Colors.transparent,child:ClipR