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

Merge branch '24-add-shuffle-colors-button' into 'master'

Resolve "Add shuffle colors button"

Closes #24

See merge request !18
parents be7903a8 e5a4e7cc
No related branches found
No related tags found
1 merge request!18Resolve "Add shuffle colors button"
Pipeline #4965 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.17 app.versionName=0.0.18
app.versionCode=17 app.versionCode=18
Add shuffle colors button.
Ajout d'un bouton pour mélanger les couleurs.
...@@ -67,6 +67,10 @@ class GameCubit extends HydratedCubit<GameState> { ...@@ -67,6 +67,10 @@ class GameCubit extends HydratedCubit<GameState> {
refresh(); refresh();
} }
void shuffleColors() {
this.state.currentGame.shuffleColorsAgain();
}
moveCellsDown() { moveCellsDown() {
final Game currentGame = this.state.currentGame; final Game currentGame = this.state.currentGame;
......
...@@ -53,6 +53,10 @@ class Game { ...@@ -53,6 +53,10 @@ class Game {
return values; return values;
} }
void shuffleColorsAgain() {
this.shuffledColors = shuffleColors();
}
GameCell getCell(CellLocation cellLocation) { GameCell getCell(CellLocation cellLocation) {
return this.board.cells[cellLocation.row][cellLocation.col]; return this.board.cells[cellLocation.row][cellLocation.col];
} }
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unicons/unicons.dart';
import 'package:jeweled/cubit/game_cubit.dart'; import 'package:jeweled/cubit/game_cubit.dart';
import 'package:jeweled/models/game.dart'; import 'package:jeweled/models/game.dart';
...@@ -55,6 +56,13 @@ class GameTopIndicatorWidget extends StatelessWidget { ...@@ -55,6 +56,13 @@ class GameTopIndicatorWidget extends StatelessWidget {
color: availableBlocksCountTextColor, color: availableBlocksCountTextColor,
), ),
), ),
TextButton(
child: Icon(UniconsSolid.refresh),
onPressed: () {
final GameCubit gameCubit = BlocProvider.of<GameCubit>(context);
gameCubit.shuffleColors();
},
)
], ],
), ),
], ],
......
...@@ -3,7 +3,7 @@ description: Jeweled Game ...@@ -3,7 +3,7 @@ description: Jeweled Game
publish_to: 'none' publish_to: 'none'
version: 0.0.17+17 version: 0.0.18+18
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