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

Merge branch '18-disable-fill-buttons-while-animation-is-in-progress' into 'master'

Resolve "Disable fill buttons while animation is in progress"

Closes #18

See merge request !15
parents d8557737 b73d6e37
No related branches found
No related tags found
1 merge request!15Resolve "Disable fill buttons while animation is in progress"
Pipeline #2807 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.14
app.versionCode=14
app.versionName=0.0.15
app.versionCode=15
......@@ -39,7 +39,9 @@ class Cell {
fit: BoxFit.fill
),
onTap: () {
if (!myProvider.animationInProgress) {
BoardUtils.fillBoardFromFirstCell(myProvider, this.value);
}
},
)
);
......
......@@ -32,6 +32,7 @@ class Data extends ChangeNotifier {
// Game data
bool _gameIsRunning = false;
bool _animationInProgress = false;
bool _gameWon = false;
int _boardSize = 0;
int _colorsCount = 0;
......@@ -224,6 +225,12 @@ class Data extends ChangeNotifier {
notifyListeners();
}
bool get animationInProgress => _animationInProgress;
void updateAnimationInProgress(bool animationInProgress) {
_animationInProgress = animationInProgress;
notifyListeners();
}
void resetGame() {
_gameIsRunning = false;
_gameWon = false;
......
......@@ -66,6 +66,7 @@ class BoardUtils {
Timer _timerAnimateBoard;
const interval = const Duration(milliseconds: 10);
int cellIndex = 0;
myProvider.updateAnimationInProgress(true);
_timerAnimateBoard = new Timer.periodic(
interval,
(Timer timer) {
......@@ -81,6 +82,7 @@ class BoardUtils {
myProvider.updateProgress(progressAfterMove);
myProvider.incrementMovesCount();
myProvider.updateAnimationInProgress(false);
if (BoardUtils.checkBoardIsSolved(myProvider)) {
myProvider.updateGameWon(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment