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
e5ac2049
Commit
e5ac2049
authored
3 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '9-improve-select-image-layout' into 'master'
Resolve "Improve select image layout" Closes
#9
See merge request
!13
parents
2b0050ba
61adbc23
No related branches found
No related tags found
1 merge request
!13
Resolve "Improve select image layout"
Pipeline
#1248
passed
3 years ago
Stage: update
Stage: build-debug
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
android/gradle.properties
+2
-2
2 additions, 2 deletions
android/gradle.properties
lib/screens/home.dart
+51
-18
51 additions, 18 deletions
lib/screens/home.dart
with
53 additions
and
20 deletions
android/gradle.properties
+
2
−
2
View file @
e5ac2049
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/screens/home.dart
+
51
−
18
View file @
e5ac2049
...
...
@@ -12,7 +12,6 @@ import '../utils/get_images_list.dart';
class
Home
extends
StatelessWidget
{
static
const
String
id
=
'home'
;
double
_selectorImageSize
=
200
;
double
_tipImageSize
=
100
;
double
_tileImageSize
=
80
;
...
...
@@ -30,6 +29,7 @@ class Home extends StatelessWidget {
await
getImagesList
.
init
();
if
(
getImagesList
.
images
!=
null
)
{
myProvider
.
updateImages
=
getImagesList
.
images
;
shuffleImages
(
myProvider
);
}
}
...
...
@@ -40,7 +40,13 @@ class Home extends StatelessWidget {
myProvider
.
updateShuffling
=
false
;
}
Container
_buildImageSelectorItem
(
Data
myProvider
,
String
image
)
{
void
shuffleImages
(
Data
myProvider
)
{
List
images
=
myProvider
.
images
;
images
.
shuffle
();
myProvider
.
updateImages
=
images
;
}
Container
_buildImageSelectorItem
(
Data
myProvider
,
String
image
,
double
size
)
{
return
Container
(
child:
FlatButton
(
child:
Container
(
...
...
@@ -54,8 +60,8 @@ class Home extends StatelessWidget {
margin:
EdgeInsets
.
all
(
2
),
child:
Image
(
image:
AssetImage
(
getImageAssetName
(
image
)),
width:
_selectorImageS
ize
,
height:
_selectorImageS
ize
,
width:
s
ize
,
height:
s
ize
,
fit:
BoxFit
.
fill
),
),
...
...
@@ -64,7 +70,7 @@ class Home extends StatelessWidget {
);
}
Container
_buildImageSelector
(
Data
myProvider
)
{
Container
_buildImageSelector
(
Data
myProvider
,
double
size
)
{
if
(
myProvider
.
images
.
length
==
0
)
{
getImagesList
(
myProvider
);
}
...
...
@@ -74,8 +80,27 @@ class Home extends StatelessWidget {
padding:
EdgeInsets
.
all
(
5
),
child:
ListView
(
children:
[
for
(
var
image
in
images
)
_buildImageSelectorItem
(
myProvider
,
image
),
Table
(
defaultColumnWidth:
IntrinsicColumnWidth
(),
children:
[
for
(
var
imageIndex
=
0
;
imageIndex
<
images
.
length
;
imageIndex
+=
2
)
TableRow
(
children:
[
Column
(
children:
[
_buildImageSelectorItem
(
myProvider
,
images
[
imageIndex
],
size
)
]
),
Column
(
children:
[
if
(
imageIndex
+
1
<
images
.
length
)
_buildImageSelectorItem
(
myProvider
,
images
[
imageIndex
+
1
],
size
)
]
),
]
),
],
),
],
),
);
...
...
@@ -253,29 +278,37 @@ class Home extends StatelessWidget {
var
content
;
double
_selectorImageSize
=
MediaQuery
.
of
(
context
)
.
size
.
width
/
3
;
if
(
_myProvider
.
shuffling
)
{
content
=
_buildShufflingIndicatorWidget
();
}
else
{
if
(
_myProvider
.
image
==
''
)
{
content
=
_buildImageSelector
(
_myProvider
);
content
=
_buildImageSelector
(
_myProvider
,
_selectorImageSize
);
}
else
{
content
=
_buildGameWidget
(
_myProvider
);
}
}
List
<
Widget
>
menuActions
=
[
IconButton
(
icon:
const
Icon
(
Icons
.
shuffle
),
onPressed:
()
=
>
shuffleImages
(
_myProvider
),
),
_buildTilesetSizeSelector
(
_myProvider
),
];
List
<
Widget
>
gameActions
=
[
IconButton
(
icon:
const
Icon
(
Icons
.
arrow_left_outlined
),
onPressed:
()
=
>
resetGame
(
_myProvider
),
)
];
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Puzzle'
),
actions:
<
Widget
>[
_myProvider
.
image
==
''
?
Text
(
''
)
:
IconButton
(
icon:
const
Icon
(
Icons
.
arrow_left_outlined
),
onPressed:
()
=
>
resetGame
(
_myProvider
),
)
,
_myProvider
.
image
==
''
?
_buildTilesetSizeSelector
(
_myProvider
)
:
Text
(
''
),
],
actions:
_myProvider
.
image
==
''
?
menuActions
:
gameActions
,
),
body:
SafeArea
(
child:
Center
(
...
...
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