首页 > 解决方案 > 我收到错误,例如超出最大调用大小它可以正常运行,但是当调用 resultscreen 时,它会在模拟器中出现此错误

问题描述

导入“包:测验/result.dart”;

类 quizscreen 扩展 StatefulWidget { quizscreen(int i, {Key?key}) : super(key: key);

@override _quizscreenState createState() => _quizscreenState(); }

类 _quizscreenState 扩展状态 { var i = 1;

var colorofbutton = '白色'; 变量分数 = 0;

of(context).pushReplacement(MaterialPageRoute(builder: (context) => resultscreen(score), )); } setState(() { i++; }); 打印(分数);},孩子:文本(数据[1][i.toString()][“a”],样式:TextStyle(颜色:Colors.white,fontSize:16.0,),maxLines:1,),颜色:Colors.grey [900],splashColor:Colors.grey,形状:RoundedRectangleBorder(borderRadius:BorderRadius.circular(20.0)),),),容器(填充:EdgeInsets.fromLTRB(50,0,50,20),孩子:MaterialButton(onPressed : () { if (data[2][i.toString()] == data[1][i.toString()]["b"]) { score += 5; } else if (i > 5) { Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context) => resultscreen(score), )); } setState(() { i++; }); print(score); }, child: Text(data [1][i.toString()]["b"],样式:TextStyle(颜色:Colors.white,fontSize:16.0,),() { if (data[2][i.toString()] == data[1][i.toString()]["d"]) { score += 5; } setState(() { if (i < 10) { i++; } else { Navigator.of(context) .pushReplacement(MaterialPageRoute( builder: (context) => resultscreen(score), )); } }); 打印(分数);},子:文本(数据[1][i.toString()][“d”],样式:TextStyle(颜色:Colors.white,fontSize:16.0,),maxLines:1,),颜色:Colors.grey [900],splashColor:Colors.grey,形状:RoundedRectangleBorder(borderRadius:BorderRadius.circular(20.0)),),),]));} }), ); } } TextStyle(颜色:Colors.white,fontSize:16.0,),maxLines:1,),颜色:Colors.grey[900],splashColor:Colors.grey,形状:RoundedRectangleBorder(borderRadius:BorderRadius.circular(20.0)),) , ), ])); } }), ); } } TextStyle(颜色:Colors.white,fontSize:16.0,),maxLines:1,),颜色:Colors.grey[900],splashColor:Colors.grey,形状:RoundedRectangleBorder(borderRadius:BorderRadius.circular(20.0)),) , ), ])); } }), ); } }

标签: visual-studio-codeflutter-test

解决方案


推荐阅读