Skip to content

Instantly share code, notes, and snippets.

@MarcinusX
Created January 14, 2019 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcinusX/aceec4d12fa5779f575aef2feab54b90 to your computer and use it in GitHub Desktop.
Save MarcinusX/aceec4d12fa5779f575aef2feab54b90 to your computer and use it in GitHub Desktop.
class _MainPageState extends State<MainPage> with SingleTickerProviderStateMixin {
...
void _restart() {
setState(() {
hasStarted = false;
isPlaying = true;
notes = initNotes();
points = 0;
currentNoteIndex = 0;
});
animationController.reset();
}
void _showFinishDialog() {
showDialog(
...
).then((_) => _restart()); //<-- restart game when dialog is closed
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment