答案 0 :(得分:0)
尝试将 key: UniqueKey()
属性添加到两个脚手架
答案 1 :(得分:0)
将 MaterialApp
重构为单独的小部件。
class App extends StatelessWidget{
build(context){
return MaterialApp(home:First());
}
}
class First extends StatelessWidget{
build(context){
return Scaffold();//add button to navigate to other page
}
}
class Second extends StatelessWidget{
build(context){
return Scaffold();
}
}