昨天问了一个关于在AlertDialog中显示GridView的非常相似的问题,并得到了将Widget包装在容器中并增加宽度的完美答案。现在我决定SimpleDialog会更好,以提供更多功能/自定义,即搜索文本字段和多个操作按钮。我在显示文本字段和IconButton时得到了想要的结果,但是当我尝试添加GridView时却出错了。我应用了以前的规则,但我遇到了类似的错误,其中UI消失但没有显示小部件。我试过为不同的小部件添加宽度,但没有成功。这是我的代码...Future_neverSatisfied()async{returnshowDialog(context:context,b
我创建了SimpleDialog和许多由数据列表生成的SimpleDialogOptions,是否可以检测到该SimpleDialogOption的索引?如果不是,我正在尝试在对话框中使用列表,但它只显示一个空对话框,那么我如何在对话框中使用列表? 最佳答案 我想到了两个办法1.Map和indexOf方法2.用简单的for循环结果:代码:import'dart:async';import'package:flutter/material.dart';voidmain()=>runApp(newMaterialApp(home:new
我需要一种方法来在SimpleDialog上执行操作时关闭模态底部工作表,我有这样的东西:Widget_getActionsMenu(){returnContainer(padding:EdgeInsets.fromLTRB(0.0,0.0,10.0,0.0),child:IconButton(icon:Icon(Icons.arrow_forward_ios),color:Colors.grey[400],onPressed:(){showModalBottomSheet(context:context,builder:(BuildContextcontext){returnnewC
我添加了一个带有2个选项的SimpleDialog:lost和found。每当我做出选择并被重定向到我想要的地方时,theSimpleDialogdoesn'tcloseandstaysonmyscreen.开关:switch(awaitshowDialog(context:context,child:newSimpleDialog(title:newText("Whichcategory?"),children:[newSimpleDialogOption(child:newText("Found"),onPressed:(){goToCreate();},),newSimpleDi
我想使用以下代码在我的Flutter应用中显示一个带有ListView.builder的SimpleDialog:showDialog(context:context,builder:(BuildContextcontext){returnnewSimpleDialog(children:[newFittedBox(child:newListView(children:[newText("one"),newText("two"),],),)],);},);这给出了这个错误(抱歉,我无法将日志包装为代码,因为Stackoverflow提示代码太多):══╡EXCEPTIONCAUGHTB
我试图在点击FloatingActionButton后创建一个SimpleDialog,但是当按下该按钮时没有任何反应。我做错了什么?import"package:flutter/material.dart";voidmain(){runApp(newControlleApp());}classControlleAppextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnnewMaterialApp(home:newHomePage(),);}}classHomePageextendsStatele