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

Disable remove cell from board when animation is in progress

parent be5ae9f2
No related branches found
No related tags found
1 merge request!52Resolve "Disable tap on cell while animation is in progress"
Pipeline #4899 passed
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=1.0.42 app.versionName=1.0.43
app.versionCode=43 app.versionCode=44
...@@ -153,14 +153,27 @@ class _GameBoardWidget extends State<GameBoardWidget> with TickerProviderStateMi ...@@ -153,14 +153,27 @@ class _GameBoardWidget extends State<GameBoardWidget> with TickerProviderStateMi
return GestureDetector( return GestureDetector(
child: buildBoard(), child: buildBoard(),
onTapUp: (details) { onTapUp: (details) {
double xTap = details.localPosition.dx; bool canRemoveCell = true;
double yTap = details.localPosition.dy; animations.forEach((row) {
row.forEach((cell) {
int x = (xTap / widgetWidth * columnsCount).toInt(); if (cell != null) {
int y = (yTap / widgetHeight * rowsCount).toInt(); canRemoveCell = false;
print('[' + x.toString() + ',' + y.toString() + ']'); }
});
removeCell(context, x, y); });
if (canRemoveCell) {
double xTap = details.localPosition.dx;
double yTap = details.localPosition.dy;
int x = (xTap / widgetWidth * columnsCount).toInt();
int y = (yTap / widgetHeight * rowsCount).toInt();
print('[' + x.toString() + ',' + y.toString() + ']');
removeCell(context, x, y);
} else {
print('animation in progress...');
}
}, },
); );
} }
......
...@@ -3,7 +3,7 @@ description: A random application, for testing purpose only. ...@@ -3,7 +3,7 @@ description: A random application, for testing purpose only.
publish_to: 'none' publish_to: 'none'
version: 1.0.42+43 version: 1.0.43+44
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