openThen function
dynamic
openThen(})
Open a window, execute @then until window closed
Implementation
openThen(context, Widget page,
{Function? then, Function? beforeOpen, Function? afterClose}) {
if (beforeOpen != null) {
beforeOpen();
} else {
SoundPlayer.i.play(Sounds.action);
}
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
return page;
})).then((_) {
if (then != null) then();
if (afterClose != null) {
afterClose();
} else {
SoundPlayer.i.play(Sounds.wood_hit);
}
});
}