Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
org.benoitharrault.petitbac
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.petitbac
Commits
237d9514
Commit
237d9514
authored
4 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Patches
Plain Diff
Fix layout, improve gameplay
parent
69a4c3e1
No related branches found
No related tags found
1 merge request
!16
Resolve "Improve layout and gameplay"
Pipeline
#1156
passed
4 years ago
Stage: update
Stage: build-debug
Changes
3
Pipelines
1
Show 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
+1
-1
1 addition, 1 deletion
lib/provider/data.dart
lib/screens/home.dart
+47
-39
47 additions, 39 deletions
lib/screens/home.dart
with
50 additions
and
42 deletions
android/gradle.properties
+
2
−
2
View file @
237d9514
org.gradle.jvmargs
=
-Xmx1536M
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.useAndroidX
=
true
android.enableJetifier
=
true
android.enableJetifier
=
true
app.versionName
=
1.2.
7
app.versionName
=
1.2.
8
app.versionCode
=
1
3
app.versionCode
=
1
4
This diff is collapsed.
Click to expand it.
lib/provider/data.dart
+
1
−
1
View file @
237d9514
...
@@ -7,7 +7,7 @@ class Data extends ChangeNotifier {
...
@@ -7,7 +7,7 @@ class Data extends ChangeNotifier {
bool
_searchingLetter
=
false
;
bool
_searchingLetter
=
false
;
String
_category
=
''
;
String
_category
=
''
;
String
_letter
=
''
;
String
_letter
=
''
;
int
_countdown
=
0
;
int
_countdown
=
-
1
;
bool
get
searchingCategory
=
>
_searchingCategory
;
bool
get
searchingCategory
=
>
_searchingCategory
;
...
...
This diff is collapsed.
Click to expand it.
lib/screens/home.dart
+
47
−
39
View file @
237d9514
...
@@ -17,7 +17,7 @@ class Home extends StatelessWidget {
...
@@ -17,7 +17,7 @@ class Home extends StatelessWidget {
int
_countdownStart
=
10
;
int
_countdownStart
=
10
;
Future
<
void
>
startMiniGame
(
Data
myProvider
)
async
{
Future
<
void
>
startMiniGame
(
Data
myProvider
)
async
{
if
(
myProvider
.
countdown
=
=
0
)
{
if
(
myProvider
.
countdown
<
=
0
)
{
pickCategory
(
myProvider
);
pickCategory
(
myProvider
);
pickLetter
(
myProvider
);
pickLetter
(
myProvider
);
startTimer
(
myProvider
);
startTimer
(
myProvider
);
...
@@ -34,7 +34,7 @@ class Home extends StatelessWidget {
...
@@ -34,7 +34,7 @@ class Home extends StatelessWidget {
_timer
=
new
Timer
.
periodic
(
_timer
=
new
Timer
.
periodic
(
oneSec
,
oneSec
,
(
Timer
timer
)
{
(
Timer
timer
)
{
if
(
_countdownStart
==
0
)
{
if
(
_countdownStart
<
0
)
{
timer
.
cancel
();
timer
.
cancel
();
}
else
{
}
else
{
_countdownStart
--
;
_countdownStart
--
;
...
@@ -87,7 +87,7 @@ class Home extends StatelessWidget {
...
@@ -87,7 +87,7 @@ class Home extends StatelessWidget {
return
hslDark
.
toColor
();
return
hslDark
.
toColor
();
}
}
Container
_buildPickedLetterContainer
(
Data
myProvider
,
Color
backgroundColor
)
{
Container
_buildPickedLetterContainer
(
Data
myProvider
,
Color
backgroundColor
,
double
borderWidth
)
{
Color
borderColor
=
darken
(
backgroundColor
);
Color
borderColor
=
darken
(
backgroundColor
);
return
Container
(
return
Container
(
...
@@ -96,14 +96,14 @@ class Home extends StatelessWidget {
...
@@ -96,14 +96,14 @@ class Home extends StatelessWidget {
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
all
(
15
),
margin:
EdgeInsets
.
all
(
borderWidth
),
padding:
EdgeInsets
.
all
(
15
),
padding:
EdgeInsets
.
all
(
borderWidth
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
backgroundColor
,
color:
backgroundColor
,
borderRadius:
BorderRadius
.
circular
(
4
),
borderRadius:
BorderRadius
.
circular
(
borderWidth
),
border:
Border
.
all
(
border:
Border
.
all
(
color:
borderColor
,
color:
borderColor
,
width:
4
,
width:
borderWidth
,
),
),
),
),
child:
FlatButton
(
child:
FlatButton
(
...
@@ -123,8 +123,7 @@ class Home extends StatelessWidget {
...
@@ -123,8 +123,7 @@ class Home extends StatelessWidget {
);
);
}
}
Container
_buildPickedCategoryContainer
(
Data
myProvider
,
Color
backgroundColor
,
double
borderWidth
)
{
Container
_buildPickedCategoryContainer
(
Data
myProvider
,
Color
backgroundColor
)
{
Color
borderColor
=
darken
(
backgroundColor
);
Color
borderColor
=
darken
(
backgroundColor
);
return
Container
(
return
Container
(
...
@@ -133,22 +132,23 @@ class Home extends StatelessWidget {
...
@@ -133,22 +132,23 @@ class Home extends StatelessWidget {
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
all
(
5
),
margin:
EdgeInsets
.
all
(
borderWidth
),
padding:
EdgeInsets
.
all
(
5
),
padding:
EdgeInsets
.
all
(
borderWidth
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
backgroundColor
,
color:
backgroundColor
,
borderRadius:
BorderRadius
.
circular
(
4
),
borderRadius:
BorderRadius
.
circular
(
borderWidth
),
border:
Border
.
all
(
border:
Border
.
all
(
color:
borderColor
,
color:
borderColor
,
width:
4
,
width:
borderWidth
,
),
),
),
),
child:
FlatButton
(
child:
FlatButton
(
onPressed:
()
=
>
pickCategory
(
myProvider
),
onPressed:
()
=
>
pickCategory
(
myProvider
),
child:
Text
(
child:
Text
(
myProvider
.
category
==
''
?
"🔀"
:
myProvider
.
category
,
myProvider
.
category
==
''
?
"🔀"
:
myProvider
.
category
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
4
0
,
fontSize:
3
0
,
fontWeight:
FontWeight
.
w600
,
fontWeight:
FontWeight
.
w600
,
color:
Colors
.
black
,
color:
Colors
.
black
,
),
),
...
@@ -160,33 +160,40 @@ class Home extends StatelessWidget {
...
@@ -160,33 +160,40 @@ class Home extends StatelessWidget {
);
);
}
}
Container
_buildMiniGameContainer
(
Data
myProvider
,
Color
backgroundColor
)
{
Container
_buildMiniGameContainer
(
Data
myProvider
,
Color
backgroundColor
,
double
borderWidth
)
{
Color
borderColor
=
darken
(
backgroundColor
);
Color
borderColor
=
darken
(
backgroundColor
);
Color
countDownColor
=
Colors
.
black
;
if
(
myProvider
.
countdown
==
0
)
{
countDownColor
=
Colors
.
red
;
}
return
Container
(
return
Container
(
margin:
EdgeInsets
.
all
(
5
),
child:
Column
(
padding:
EdgeInsets
.
all
(
5
),
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Container
(
margin:
EdgeInsets
.
all
(
borderWidth
),
padding:
EdgeInsets
.
all
(
borderWidth
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
backgroundColor
,
color:
backgroundColor
,
borderRadius:
BorderRadius
.
circular
(
4
),
borderRadius:
BorderRadius
.
circular
(
borderWidth
),
border:
Border
.
all
(
border:
Border
.
all
(
color:
borderColor
,
color:
borderColor
,
width:
4
,
width:
borderWidth
,
),
),
),
),
child:
Column
(
child:
FlatButton
(
mainAxisSize:
MainAxisSize
.
min
,
onPressed:
(
myProvider
.
countdown
>
=
0
)
?
null
:
()
=
>
startMiniGame
(
myProvider
),
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
FlatButton
(
onPressed:
(
myProvider
.
countdown
!=
0
)
?
null
:
()
=
>
startMiniGame
(
myProvider
),
padding:
EdgeInsets
.
all
(
10.0
),
child:
Text
(
child:
Text
(
(
myProvider
.
countdown
!=
0
)
?
myProvider
.
countdown
.
toString
()
:
'🎲'
,
(
myProvider
.
countdown
>
=
0
)
?
myProvider
.
countdown
.
toString
()
:
'🎲'
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
50
,
fontSize:
50
,
fontWeight:
FontWeight
.
w600
,
fontWeight:
FontWeight
.
w600
,
color:
Colors
.
black
,
color:
countDownColor
,
),
),
),
),
),
),
),
...
@@ -198,6 +205,7 @@ class Home extends StatelessWidget {
...
@@ -198,6 +205,7 @@ class Home extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
Data
_myProvider
=
Provider
.
of
<
Data
>(
context
);
Data
_myProvider
=
Provider
.
of
<
Data
>(
context
);
double
borderWidth
=
8
;
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
...
@@ -207,11 +215,11 @@ class Home extends StatelessWidget {
...
@@ -207,11 +215,11 @@ class Home extends StatelessWidget {
child:
Column
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
_buildPickedLetterContainer
(
_myProvider
,
Colors
.
orange
),
_buildPickedLetterContainer
(
_myProvider
,
Colors
.
orange
,
borderWidth
),
SizedBox
(
height:
20
),
SizedBox
(
height:
5
),
_build
PickedCategory
Container
(
_myProvider
,
Colors
.
green
),
_build
MiniGame
Container
(
_myProvider
,
Colors
.
blue
,
borderWidth
),
SizedBox
(
height:
40
),
SizedBox
(
height:
5
),
_build
MiniGame
Container
(
_myProvider
,
Colors
.
blue
),
_build
PickedCategory
Container
(
_myProvider
,
Colors
.
green
,
borderWidth
),
],
],
),
),
),
),
...
...
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