我想回到我的代码的开头重新加载代码,或者只是将它(showdialog)连接到通过单击 showdialog 窗口重新加载我的小部件的功能?
void showWWWEndDialog() {
showDialog(
context: context,
builder: (BuildContext context) {
// return object of type Dialog
return AlertDialog(
title: new Text("Witcher Memory"),
content: new Text("Brawo! Gra zakończona. Chcesz zacząć nową?"),
actions: <Widget>[
// usually buttons at the bottom of the dialog
new FlatButton(
child: new Text("Nie"),
onPressed: () {
Navigator.pop(context, "no");
},
),
new FlatButton(
child: new Text("Tak"),
onPressed: () {
_restartGame = true;
Navigator.pop(context, "yes");
//
},
),
],
);
},
);
}
void gameRestart() {
for(var i = 0; i < boardRowCount; i++)
for(var j = 0; j < boardColumnCount; j++){
boardState[i][j] = new PlayCard(i * boardColumnCount + j, getRandomAsset());
}
}
如果您打算Widget
从应用程序中的任何一点转到应用程序的第一页(页面),您可以试试这个。如果用户在导航到HomePage
.
Navigator.pushNamedAndRemoveUntil(context, "/homepage", (p) => false);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句