File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,7 +186,6 @@ class _TetrisGameScreenState extends State<TetrisGameScreen>
186186 final wasRunning =
187187 gameLogic.isGameRunning && ! gameLogic.isGameOver && ! gameLogic.isPaused;
188188 if (wasRunning) gameLogic.pauseGame ();
189- _audioService.pauseMusic ();
190189
191190 await Navigator .push (
192191 context,
@@ -195,7 +194,6 @@ class _TetrisGameScreenState extends State<TetrisGameScreen>
195194 settings: widget.settings,
196195 onRestart: () {
197196 gameLogic.startGame ();
198- if (widget.settings.musicEnabled) _audioService.startMusic ();
199197 },
200198 onQuit: () {
201199 if (defaultTargetPlatform == TargetPlatform .android)
@@ -215,9 +213,6 @@ class _TetrisGameScreenState extends State<TetrisGameScreen>
215213 gameLogic.isPaused) {
216214 gameLogic.resumeGame ();
217215 }
218- if (mounted && widget.settings.musicEnabled) {
219- _audioService.resumeMusic ();
220- }
221216 }
222217
223218 void _onGameStateChanged () {
@@ -348,6 +343,7 @@ class _TetrisGameScreenState extends State<TetrisGameScreen>
348343 switch (state) {
349344 case AppLifecycleState .paused:
350345 case AppLifecycleState .inactive:
346+ _audioService.pauseMusic ();
351347 case AppLifecycleState .detached:
352348 // App is going to background or being minimized - pause the game
353349 if (gameLogic.isGameRunning &&
You can’t perform that action at this time.
0 commit comments