Skip to content
Snippets Groups Projects
Commit edff7d5f authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Fix end game block

parent d368e388
No related branches found
No related tags found
1 merge request!27Resolve "Fix end game block"
Pipeline #3791 passed
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.23 app.versionName=0.0.24
app.versionCode=23 app.versionCode=24
Fix display end game block
Correction sur l'affichage du block de fin de partie
...@@ -30,15 +30,13 @@ class Game { ...@@ -30,15 +30,13 @@ class Game {
); );
} }
static TextButton buildRestartGameButton(Data myProvider) { static TextButton buildQuitGameButton(Data myProvider) {
return TextButton( return TextButton(
child: Container(
child: Image( child: Image(
image: AssetImage('assets/icons/button_back.png'), image: AssetImage('assets/icons/button_back.png'),
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
), onPressed: () => GameUtils.quitGame(myProvider),
onPressed: () => GameUtils.resetGame(myProvider),
); );
} }
...@@ -50,9 +48,12 @@ class Game { ...@@ -50,9 +48,12 @@ class Game {
decorationImageAssetName = 'assets/icons/game_fail.png'; decorationImageAssetName = 'assets/icons/game_fail.png';
} }
Image decorationImage = Image( Widget decorationWidget = TextButton(
child: Image(
image: AssetImage(decorationImageAssetName), image: AssetImage(decorationImageAssetName),
fit: BoxFit.fill, fit: BoxFit.fill,
),
onPressed: () => null,
); );
return Container( return Container(
...@@ -63,9 +64,15 @@ class Game { ...@@ -63,9 +64,15 @@ class Game {
children: [ children: [
TableRow( TableRow(
children: [ children: [
Column(children: [decorationImage]), Column(
Column(children: [buildRestartGameButton(myProvider)]), children: [decorationWidget],
Column(children: [decorationImage]), ),
Column(
children: [buildQuitGameButton(myProvider)],
),
Column(
children: [decorationWidget],
),
], ],
), ),
], ],
......
...@@ -39,7 +39,7 @@ class _HomeState extends State<Home> { ...@@ -39,7 +39,7 @@ class _HomeState extends State<Home> {
), ),
), ),
onPressed: () => toast('Long press to quit game...'), onPressed: () => toast('Long press to quit game...'),
onLongPress: () => GameUtils.resetGame(myProvider), onLongPress: () => GameUtils.quitGame(myProvider),
), ),
]; ];
} }
......
...@@ -2,7 +2,7 @@ import '../provider/data.dart'; ...@@ -2,7 +2,7 @@ import '../provider/data.dart';
import '../utils/random_pick_word.dart'; import '../utils/random_pick_word.dart';
class GameUtils { class GameUtils {
static Future<void> resetGame(Data myProvider) async { static Future<void> quitGame(Data myProvider) async {
myProvider.updateGameIsRunning(false); myProvider.updateGameIsRunning(false);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment