我有一个看起来像这样的应用
class MainScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => MainScreenState();
}
class MainScreenState extends State<MainScreen> {
@override
Widget build(BuildContext context) {
return new Container(
child: FlatButton(
onPressed:() {
// Want pop up to launch
},
),
)
}
}
class PopUp extends StatefulWidget {
PopUp({
this.postId
})
@override
State<StatefulWidget> createState() => PopUpState();
}
class PopUpState extends State<PopUp> {
// api logic
@override
Widget build(BuildContext context) {
return new Dialog()
}
}
是否可以在不使用showDialog的情况下将PopUp
小部件覆盖在MainScreen小部件之上?因为我试图使PopUp成为有状态的,因为它会根据处理后的数据进行处理和重新呈现?