DealORound / Deal-O-Round

Flutter port of the Deal-O-Round board card game
MIT License
2 stars 0 forks source link

Submit score if the player abandons the game board by pressing the native back button #17

Closed MrCsabaToth closed 4 years ago

MrCsabaToth commented 4 years ago

Currently the score is only submitted when the countdown finishes and the game transitions to the game over screen. The game may end also if the player decides to navigate away from the game by pressing the back button. This could be even accidental. In such case right now the current score effort of the player is lost.

MrCsabaToth commented 4 years ago

This case will have to be captured in the GamePage's dispose. However we will still need to tell apart ff the dispose is because of the back button or we caused it by the Get.to navigation. The two cases could be set aside by a boolean flag in the state, we can clear that flag on initState and set it right before we Get.to. From then on the lack of flag in dispose means it's a back navigation or other navigation not initiated by us.