Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
org.benoitharrault.puzzlegame
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.puzzlegame
Commits
b941c17b
Commit
b941c17b
authored
3 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Patches
Plain Diff
Add "shuffling" indicator
parent
e919f342
No related branches found
No related tags found
1 merge request
!6
Resolve "Add loading indicator when splitting/shuffling image"
Pipeline
#1188
passed
3 years ago
Stage: update
Stage: build-debug
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
android/gradle.properties
+2
-2
2 additions, 2 deletions
android/gradle.properties
lib/provider/data.dart
+9
-0
9 additions, 0 deletions
lib/provider/data.dart
lib/screens/home.dart
+34
-3
34 additions, 3 deletions
lib/screens/home.dart
with
45 additions
and
5 deletions
android/gradle.properties
+
2
−
2
View file @
b941c17b
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.enableJetifier
=
true
app.versionName
=
0.0.
3
app.versionCode
=
3
app.versionName
=
0.0.
4
app.versionCode
=
4
This diff is collapsed.
Click to expand it.
lib/provider/data.dart
+
9
−
0
View file @
b941c17b
...
...
@@ -7,6 +7,8 @@ class Data extends ChangeNotifier {
String
_image
=
''
;
List
_tiles
=
[];
// application state
bool
_shuffling
=
false
;
String
get
image
=
>
_image
;
...
...
@@ -29,6 +31,13 @@ class Data extends ChangeNotifier {
notifyListeners
();
}
bool
get
shuffling
=
>
_shuffling
;
set
updateShuffling
(
bool
value
)
{
_shuffling
=
value
;
notifyListeners
();
}
void
resetGame
()
{
_image
=
''
;
notifyListeners
();
...
...
This diff is collapsed.
Click to expand it.
lib/screens/home.dart
+
34
−
3
View file @
b941c17b
...
...
@@ -36,8 +36,10 @@ class Home extends StatelessWidget {
}
Future
<
void
>
selectImage
(
Data
myProvider
,
String
imageCode
)
async
{
myProvider
.
updateShuffling
=
true
;
myProvider
.
updateImage
=
imageCode
;
myProvider
.
updateTiles
=
await
splitImageInTiles
(
myProvider
);
myProvider
.
updateShuffling
=
false
;
}
Container
_buildImageSelectorItem
(
Data
myProvider
,
String
image
)
{
...
...
@@ -205,10 +207,41 @@ class Home extends StatelessWidget {
);
}
Container
_buildShufflingIndicatorWidget
()
{
return
Container
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
'⏳'
,
style:
TextStyle
(
fontSize:
60
,
fontWeight:
FontWeight
.
w600
,
color:
Colors
.
black
,
),
),
],
),
);
}
@override
Widget
build
(
BuildContext
context
)
{
Data
_myProvider
=
Provider
.
of
<
Data
>(
context
);
var
content
;
if
(
_myProvider
.
shuffling
)
{
content
=
_buildShufflingIndicatorWidget
();
}
else
{
if
(
_myProvider
.
image
==
''
)
{
content
=
_buildImageSelector
(
_myProvider
);
}
else
{
content
=
_buildGameWidget
(
_myProvider
);
}
}
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Puzzle'
),
...
...
@@ -223,9 +256,7 @@ class Home extends StatelessWidget {
),
body:
SafeArea
(
child:
Center
(
child:
_myProvider
.
image
==
''
?
_buildImageSelector
(
_myProvider
)
:
_buildGameWidget
(
_myProvider
),
child:
content
),
)
);
...
...
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