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

Fix "all categories" game theme

parent d09947a3
Branches
Tags
1 merge request!28Resolve "Fix all categories game"
Pipeline #5761 passed
This commit is part of merge request !28. Comments created here will be created in the context of that merge request.
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.1.0 app.versionName=0.1.1
app.versionCode=27 app.versionCode=28
Fix "all" categories game theme.
Correction sur le jeu "toutes catégories".
...@@ -100,7 +100,7 @@ class GameCubit extends HydratedCubit<GameState> { ...@@ -100,7 +100,7 @@ class GameCubit extends HydratedCubit<GameState> {
@override @override
Map<String, dynamic>? toJson(GameState state) { Map<String, dynamic>? toJson(GameState state) {
return <String, dynamic>{ return <String, dynamic>{
'currentGame': state.currentGame.toJson(), 'currentGame': state.currentGame,
}; };
} }
} }
...@@ -101,8 +101,8 @@ class FetchDataHelper { ...@@ -101,8 +101,8 @@ class FetchDataHelper {
List<GameItem> items = _mapping; List<GameItem> items = _mapping;
// Remove unwanted categories if theme is selected // Remove unwanted categories if theme is selected
if (themeCode != '') {
final GameTheme gameTheme = getTheme(code: themeCode); final GameTheme gameTheme = getTheme(code: themeCode);
if (gameTheme.categories.isNotEmpty) {
for (GameItem item in items) { for (GameItem item in items) {
item.isCategory.removeWhere((Category category) => item.isCategory.removeWhere((Category category) =>
(!gameTheme.categories.map((Category c) => c.key).contains(category.key))); (!gameTheme.categories.map((Category c) => c.key).contains(category.key)));
......
...@@ -19,9 +19,9 @@ class GameItem { ...@@ -19,9 +19,9 @@ class GameItem {
Map<String, dynamic>? toJson() { Map<String, dynamic>? toJson() {
return <String, dynamic>{ return <String, dynamic>{
'item': item.toJson(), 'item': item,
'isCategory': isCategory.toString(), 'isCategory': isCategory,
'isNotCategory': isNotCategory.toString(), 'isNotCategory': isNotCategory,
}; };
} }
} }
...@@ -17,7 +17,7 @@ class GameTheme { ...@@ -17,7 +17,7 @@ class GameTheme {
Map<String, dynamic>? toJson() { Map<String, dynamic>? toJson() {
return <String, dynamic>{ return <String, dynamic>{
'code': code, 'code': code,
'categories': categories.toString(), 'categories': categories,
}; };
} }
} }
...@@ -15,15 +15,11 @@ class GameEndWidget extends StatelessWidget { ...@@ -15,15 +15,11 @@ class GameEndWidget extends StatelessWidget {
final Game currentGame = gameState.currentGame; final Game currentGame = gameState.currentGame;
final Image decorationImage = Image( final Image decorationImage = Image(
image: AssetImage( image: AssetImage('assets/ui/game_${currentGame.gameWon ? 'win' : 'fail'}.png'),
currentGame.gameWon ? 'assets/ui/game_win.png' : 'assets/ui/game_fail.png'),
fit: BoxFit.fill, fit: BoxFit.fill,
); );
return Container( return Table(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
child: Table(
defaultColumnWidth: const IntrinsicColumnWidth(), defaultColumnWidth: const IntrinsicColumnWidth(),
children: [ children: [
TableRow( TableRow(
...@@ -33,9 +29,7 @@ class GameEndWidget extends StatelessWidget { ...@@ -33,9 +29,7 @@ class GameEndWidget extends StatelessWidget {
), ),
Column( Column(
children: [ children: [
currentGame.animationInProgress == true currentGame.animationInProgress ? decorationImage : const QuitGameButton()
? decorationImage
: const QuitGameButton()
], ],
), ),
Column( Column(
...@@ -44,7 +38,6 @@ class GameEndWidget extends StatelessWidget { ...@@ -44,7 +38,6 @@ class GameEndWidget extends StatelessWidget {
], ],
), ),
], ],
),
); );
}, },
); );
......
...@@ -37,7 +37,7 @@ class ParametersLayout extends StatelessWidget { ...@@ -37,7 +37,7 @@ class ParametersLayout extends StatelessWidget {
lines.add(SizedBox(height: separatorHeight)); lines.add(SizedBox(height: separatorHeight));
if (canResume == false) { if (!canResume) {
// Start new game // Start new game
lines.add(const Expanded( lines.add(const Expanded(
child: StartNewGameButton(), child: StartNewGameButton(),
......
...@@ -8,7 +8,7 @@ class QuitGameButton extends StatelessWidget { ...@@ -8,7 +8,7 @@ class QuitGameButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return TextButton( return ElevatedButton(
child: const Image( child: const Image(
image: AssetImage('assets/ui/button_back.png'), image: AssetImage('assets/ui/button_back.png'),
fit: BoxFit.fill, fit: BoxFit.fill,
......
...@@ -16,7 +16,7 @@ class ScoreIndicator extends StatelessWidget { ...@@ -16,7 +16,7 @@ class ScoreIndicator extends StatelessWidget {
final Color outlineColor = baseColor.darken(); final Color outlineColor = baseColor.darken();
return OutlinedText( return OutlinedText(
text: gameState.currentGame.score.toString(), text: '${gameState.currentGame.score}',
fontSize: 70, fontSize: 70,
textColor: baseColor, textColor: baseColor,
outlineColor: outlineColor, outlineColor: outlineColor,
......
...@@ -3,7 +3,7 @@ description: A sorting game application. ...@@ -3,7 +3,7 @@ description: A sorting game application.
publish_to: "none" publish_to: "none"
version: 0.1.0+27 version: 0.1.1+28
environment: environment:
sdk: "^3.0.0" sdk: "^3.0.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment