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
No related branches found
No related tags found
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
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.1.0
app.versionCode=27
app.versionName=0.1.1
app.versionCode=28
Fix "all" categories game theme.
Correction sur le jeu "toutes catégories".
......@@ -100,7 +100,7 @@ class GameCubit extends HydratedCubit<GameState> {
@override
Map<String, dynamic>? toJson(GameState state) {
return <String, dynamic>{
'currentGame': state.currentGame.toJson(),
'currentGame': state.currentGame,
};
}
}
......@@ -101,8 +101,8 @@ class FetchDataHelper {
List<GameItem> items = _mapping;
// Remove unwanted categories if theme is selected
if (themeCode != '') {
final GameTheme gameTheme = getTheme(code: themeCode);
if (gameTheme.categories.isNotEmpty) {
for (GameItem item in items) {
item.isCategory.removeWhere((Category category) =>
(!gameTheme.categories.map((Category c) => c.key).contains(category.key)));
......
......@@ -19,9 +19,9 @@ class GameItem {
Map<String, dynamic>? toJson() {
return <String, dynamic>{
'item': item.toJson(),
'isCategory': isCategory.toString(),
'isNotCategory': isNotCategory.toString(),
'item': item,
'isCategory': isCategory,
'isNotCategory': isNotCategory,
};
}
}
......@@ -17,7 +17,7 @@ class GameTheme {
Map<String, dynamic>? toJson() {
return <String, dynamic>{
'code': code,
'categories': categories.toString(),
'categories': categories,
};
}
}
......@@ -15,15 +15,11 @@ class GameEndWidget extends StatelessWidget {
final Game currentGame = gameState.currentGame;
final Image decorationImage = Image(
image: AssetImage(
currentGame.gameWon ? 'assets/ui/game_win.png' : 'assets/ui/game_fail.png'),
image: AssetImage('assets/ui/game_${currentGame.gameWon ? 'win' : 'fail'}.png'),
fit: BoxFit.fill,
);
return Container(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
child: Table(
return Table(
defaultColumnWidth: const IntrinsicColumnWidth(),
children: [
TableRow(
......@@ -33,9 +29,7 @@ class GameEndWidget extends StatelessWidget {
),
Column(
children: [
currentGame.animationInProgress == true
? decorationImage
: const QuitGameButton()
currentGame.animationInProgress ? decorationImage : const QuitGameButton()
],
),
Column(
......@@ -44,7 +38,6 @@ class GameEndWidget extends StatelessWidget {
],
),
],
),
);
},
);
......
......@@ -37,7 +37,7 @@ class ParametersLayout extends StatelessWidget {
lines.add(SizedBox(height: separatorHeight));
if (canResume == false) {
if (!canResume) {
// Start new game
lines.add(const Expanded(
child: StartNewGameButton(),
......
......@@ -8,7 +8,7 @@ class QuitGameButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return TextButton(
return ElevatedButton(
child: const Image(
image: AssetImage('assets/ui/button_back.png'),
fit: BoxFit.fill,
......
......@@ -16,7 +16,7 @@ class ScoreIndicator extends StatelessWidget {
final Color outlineColor = baseColor.darken();
return OutlinedText(
text: gameState.currentGame.score.toString(),
text: '${gameState.currentGame.score}',
fontSize: 70,
textColor: baseColor,
outlineColor: outlineColor,
......
......@@ -3,7 +3,7 @@ description: A sorting game application.
publish_to: "none"
version: 0.1.0+27
version: 0.1.1+28
environment:
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