diff --git a/src/ui/flutter/lib/widgets/game_page.dart b/src/ui/flutter/lib/widgets/game_page.dart index a556618d..1f6080f6 100644 --- a/src/ui/flutter/lib/widgets/game_page.dart +++ b/src/ui/flutter/lib/widgets/game_page.dart @@ -63,23 +63,20 @@ class _GamePageState extends State { void showTips() { final winner = Game.shared.position.winner; - switch (winner) { - case Color.nobody: - if (Game.shared.position.phase == Phase.placing) { - changeStatus(S.of(context).tipPlace); - } else if (Game.shared.position.phase == Phase.moving) { - changeStatus(S.of(context).tipMove); - } - break; - case Color.black: - changeStatus(S.of(context).blackWin); - break; - case Color.white: - changeStatus(S.of(context).whiteWin); - break; - case Color.draw: - changeStatus(S.of(context).draw); - break; + Map colorWinStrings = { + Color.black: S.of(context).blackWin, + Color.white: S.of(context).whiteWin, + Color.draw: S.of(context).draw + }; + + if (winner == Color.nobody) { + if (Game.shared.position.phase == Phase.placing) { + changeStatus(S.of(context).tipPlace); + } else if (Game.shared.position.phase == Phase.moving) { + changeStatus(S.of(context).tipMove); + } + } else { + changeStatus(colorWinStrings[winner]); } showGameResult(winner);