我面临一个令人困惑的问题,那就是当我在某些页面中进行更改时,仅当我关闭应用程序并重新打开整个应用程序时,代码才适用。 该应用的其他页面没有此问题
class PageOne extends StatefulWidget {
double time;
int discounted;
PageOne(this.time,this.discounted);
@override
_EnterPhoneNumberState createState() => _EnterPhoneNumberState();
}
class _PageOneState extends State<PageOne> {
TextEditingController textEditingController = TextEditingController();
String errorText;
bool done = false;
bool loading = false;
GlobalKey<ScaffoldState> globalKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
print("test");
Size size = MediaQuery.of(context).size;
return Scaffold(
key:globalKey ,
appBar: PreferredSize(
child: Container(
height: 80,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xff007eff),
Color(0xff01b7fe),
]
)
),
),
preferredSize: Size(size.width, 80),
),
body:Container(
),
);
}
}
当我在主文件中更改某些代码时,我在类中的代码在通过热重载或运行正常工作时会遇到此问题