diff --git a/lib/game/game.dart b/lib/game/game.dart index 628bb48..06047da 100644 --- a/lib/game/game.dart +++ b/lib/game/game.dart @@ -295,6 +295,7 @@ class SpacescapeGame extends FlameGame case AppLifecycleState.inactive: case AppLifecycleState.paused: case AppLifecycleState.detached: + case AppLifecycleState.hidden: if (_player.health > 0) { pauseEngine(); overlays.remove(PauseButton.id); diff --git a/lib/screens/game_play.dart b/lib/screens/game_play.dart index 943b4cf..1de7463 100644 --- a/lib/screens/game_play.dart +++ b/lib/screens/game_play.dart @@ -21,8 +21,8 @@ class GamePlay extends StatelessWidget { // WillPopScope provides us a way to decide if // this widget should be poped or not when user // presses the back button. - body: WillPopScope( - onWillPop: () async => false, + body: PopScope( + canPop: false, // GameWidget is useful to inject the underlying // widget of any class extending from Flame's Game class. child: GameWidget(