问题描述
我正在尝试显示showModelBottomSheet(),并且它运行正常,在bottomSheet中有一个按钮,所以每当我按下此按钮时,它就会显示/返回一个新的Container(容器不同的Widgets)。在onTap()上,我已经将布尔变量设置为true或false ...但是不起作用。setState(());方法在ModelBottomSheet中不起作用?和showGeneralDialog()类似的情况... 我该如何解决。
bool p=true;
showModalBottomSheet(
backgroundColor: Colors.transparent,enableDrag: true,isScrollControlled: true,context: context,builder: (BuildContext context){
return p==true?Container(
width: MediaQuery.of(context).size.width,height: MediaQuery.of(context).size.height/2,padding: EdgeInsets.all(5.0),decoration: BoxDecoration(
color: Theme.of(context).primaryColor,borderRadius: BorderRadius.only(topLeft: Radius.circular(20.0),topRight: Radius.circular(20.0)),),child: Column(
children: <Widget>[
Container(
alignment: Alignment.topLeft,width: MediaQuery.of(context).size.width,height: 30.0,child: IconButton(icon: Icon(Icons.arrow_downward,color: Colors.white,size: 32.0,onPressed: (){
Navigator.pop(context);
}),Text(widget.model.cName,style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold,fontSize: 25.0,fontFamily: 'Rajdhani'),SizedBox(height: 10.0,Text('AMOUNT',style: TextStyle(color: Colors.white60,fontWeight: FontWeight.w100,fontSize: 12.0),SizedBox(height: 20.0,Text(widget.model.b,fontWeight: FontWeight.w600,fontSize: 32.0,Text('REPEAT',fontSize: 12.0,SizedBox(height: 15.0,Text('EVERY MONTH AT '+widget.model.date,fontSize: 20.0,GestureDetector(
onTap: (){
pay=false;
print('ayeeee $p');
},child: Container(
alignment: Alignment.bottomCenter,width: MediaQuery.of(context).size.width*0.8,height: 40.0,decoration: BoxDecoration(color: Colors.white,borderRadius: BorderRadius.circular(10.0),child: Center(
child: Text('P ',style: TextStyle(color: Colors.black,fontSize: 18.0,fontFamily: 'Rajdhani')),],):Container(
width: MediaQuery.of(context).size.width,Text('SOURCE',Container(
alignment: Alignment.bottomCenter,child: Center(
child: Text('PA ',);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)