Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
org.benoitharrault.colors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
android
org.benoitharrault.colors
Commits
5fd53064
Commit
5fd53064
authored
2 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '15-add-a-fill-color-animation' into 'master'
Resolve "Add a "fill color" animation" Closes
#15
See merge request
!12
parents
ec486eef
1b21065c
No related branches found
No related tags found
1 merge request
!12
Resolve "Add a "fill color" animation"
Pipeline
#2773
passed
2 years ago
Stage: update
Stage: build-debug
Changes
3
Pipelines
4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
android/gradle.properties
+2
-2
2 additions, 2 deletions
android/gradle.properties
lib/entities/cell.dart
+4
-10
4 additions, 10 deletions
lib/entities/cell.dart
lib/utils/board_utils.dart
+25
-10
25 additions, 10 deletions
lib/utils/board_utils.dart
with
31 additions
and
22 deletions
android/gradle.properties
+
2
−
2
View file @
5fd53064
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.enableJetifier
=
true
app.versionName
=
0.0.
9
app.versionCode
=
9
app.versionName
=
0.0.
10
app.versionCode
=
10
This diff is collapsed.
Click to expand it.
lib/entities/cell.dart
+
4
−
10
View file @
5fd53064
...
...
@@ -14,17 +14,11 @@ class Cell {
String
imageAsset
=
this
.
getImageAssetName
(
myProvider
);
return
Container
(
child:
AnimatedSwitcher
(
duration:
const
Duration
(
milliseconds:
100
),
transitionBuilder:
(
Widget
child
,
Animation
<
double
>
animation
)
{
return
ScaleTransition
(
child:
child
,
scale:
animation
);
},
child:
Image
(
image:
AssetImage
(
imageAsset
),
fit:
BoxFit
.
fill
,
key:
ValueKey
<
int
>(
imageAsset
.
hashCode
),
),
),
);
}
...
...
This diff is collapsed.
Click to expand it.
lib/utils/board_utils.dart
+
25
−
10
View file @
5fd53064
import
'dart:math'
;
import
'dart:async'
;
import
'../entities/cell.dart'
;
import
'../provider/data.dart'
;
...
...
@@ -56,9 +57,20 @@ class BoardUtils {
List
cellsToFill
=
BoardUtils
.
getSiblingFillableCells
(
myProvider
,
0
,
0
,
[[
0
,
0
]]);
int
progressBeforeMove
=
cellsToFill
.
length
;
for
(
var
cellIndex
=
0
;
cellIndex
<
cellsToFill
.
length
;
cellIndex
++
)
{
// Sort cells from the closest to the furthest, relatively to the top left corner
cellsToFill
.
sort
((
a
,
b
)
=
>
(
pow
(
a
[
0
],
2
)
+
pow
(
a
[
1
],
2
))
.
compareTo
(
pow
(
b
[
0
],
2
)
+
pow
(
b
[
1
],
2
)));
Timer
_timerAnimateBoard
;
const
interval
=
const
Duration
(
milliseconds:
10
);
int
cellIndex
=
0
;
_timerAnimateBoard
=
new
Timer
.
periodic
(
interval
,
(
Timer
timer
)
{
if
(
cellIndex
<
cellsToFill
.
length
)
{
myProvider
.
updateCellValue
(
cellsToFill
[
cellIndex
][
1
],
cellsToFill
[
cellIndex
][
0
],
value
);
}
cellIndex
++
;
}
else
{
timer
.
cancel
();
int
progressAfterMove
=
BoardUtils
.
getSiblingFillableCells
(
myProvider
,
0
,
0
,
[[
0
,
0
]])
.
length
;
int
progressDelta
=
progressAfterMove
-
progressBeforeMove
;
...
...
@@ -67,6 +79,9 @@ class BoardUtils {
myProvider
.
incrementMovesCount
();
}
},
);
}
static
List
getSiblingFillableCells
(
Data
myProvider
,
row
,
col
,
siblingCells
)
{
List
cells
=
myProvider
.
cells
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment