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
f7fae78b
Commit
f7fae78b
authored
4 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '12-improve-clean-layout' into 'master'
Resolve "Improve/clean layout" Closes
#12
See merge request
!13
parents
fb3486bd
b6522c95
No related branches found
No related tags found
1 merge request
!13
Resolve "Improve/clean layout"
Pipeline
#1149
canceled
4 years ago
Stage: update
Stage: build-debug
Changes
2
Pipelines
2
Show 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
+125
-66
125 additions, 66 deletions
lib/screens/home.dart
with
127 additions
and
68 deletions
android/gradle.properties
+
2
−
2
View file @
f7fae78b
org.gradle.jvmargs
=
-Xmx1536M
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.useAndroidX
=
true
android.enableJetifier
=
true
android.enableJetifier
=
true
app.versionName
=
1.2.
4
app.versionName
=
1.2.
5
app.versionCode
=
1
0
app.versionCode
=
1
1
This diff is collapsed.
Click to expand it.
lib/screens/home.dart
+
125
−
66
View file @
f7fae78b
...
@@ -16,15 +16,15 @@ class Home extends StatelessWidget {
...
@@ -16,15 +16,15 @@ class Home extends StatelessWidget {
Timer
_timer
;
Timer
_timer
;
int
_countdownStart
=
10
;
int
_countdownStart
=
10
;
Future
<
void
>
startMiniGame
(
BuildContext
context
,
Data
myProvider
)
async
{
Future
<
void
>
startMiniGame
(
Data
myProvider
)
async
{
if
(
myProvider
.
countdown
==
0
)
{
if
(
myProvider
.
countdown
==
0
)
{
pickCategory
(
context
,
myProvider
);
pickCategory
(
myProvider
);
pickLetter
(
context
,
myProvider
);
pickLetter
(
myProvider
);
startTimer
(
context
,
myProvider
);
startTimer
(
myProvider
);
}
}
}
}
Future
<
void
>
startTimer
(
BuildContext
context
,
Data
myProvider
)
async
{
Future
<
void
>
startTimer
(
Data
myProvider
)
async
{
const
oneSec
=
const
Duration
(
seconds:
1
);
const
oneSec
=
const
Duration
(
seconds:
1
);
if
(
_timer
!=
null
)
{
if
(
_timer
!=
null
)
{
dispose
();
dispose
();
...
@@ -49,7 +49,7 @@ class Home extends StatelessWidget {
...
@@ -49,7 +49,7 @@ class Home extends StatelessWidget {
_timer
.
cancel
();
_timer
.
cancel
();
}
}
Future
<
void
>
pickCategory
(
BuildContext
context
,
Data
myProvider
)
async
{
Future
<
void
>
pickCategory
(
Data
myProvider
)
async
{
myProvider
.
searchingCategory
=
true
;
myProvider
.
searchingCategory
=
true
;
RandomPickCategory
randomPickCategory
;
RandomPickCategory
randomPickCategory
;
int
attempts
=
0
;
int
attempts
=
0
;
...
@@ -65,7 +65,7 @@ class Home extends StatelessWidget {
...
@@ -65,7 +65,7 @@ class Home extends StatelessWidget {
}
while
(
attempts
<
3
);
}
while
(
attempts
<
3
);
}
}
Future
<
void
>
pickLetter
(
BuildContext
context
,
Data
myProvider
)
async
{
Future
<
void
>
pickLetter
(
Data
myProvider
)
async
{
myProvider
.
searchingLetter
=
true
;
myProvider
.
searchingLetter
=
true
;
RandomPickLetter
randomPickLetter
;
RandomPickLetter
randomPickLetter
;
int
attempts
=
0
;
int
attempts
=
0
;
...
@@ -81,80 +81,139 @@ class Home extends StatelessWidget {
...
@@ -81,80 +81,139 @@ class Home extends StatelessWidget {
}
while
(
attempts
<
3
);
}
while
(
attempts
<
3
);
}
}
Color
darken
(
Color
baseColor
,
{
double
amount
=
0.2
})
{
final
hsl
=
HSLColor
.
fromColor
(
baseColor
);
final
hslDark
=
hsl
.
withLightness
((
hsl
.
lightness
-
amount
)
.
clamp
(
0.0
,
1.0
));
return
hslDark
.
toColor
();
}
@override
Container
_buildPickedLetterContainer
(
Data
myProvider
,
Color
backgroundColor
)
{
Widget
build
(
BuildContext
context
)
{
Color
borderColor
=
darken
(
backgroundColor
);
Data
_myProvider
=
Provider
.
of
<
Data
>(
context
);
return
Scaffold
(
return
Container
(
appBar:
AppBar
(
title:
Text
(
'Petit bac'
),
),
body:
Center
(
child:
Column
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
children:
[
Column
(
FlatButton
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
onPressed:
()
=
>
pickLetter
(
myProvider
),
children:
<
Widget
>[
child:
Text
(
"🔀"
),
Text
(
),
_myProvider
.
letter
,
myProvider
.
letter
==
''
?
null
:
Container
(
style:
Theme
.
of
(
context
)
.
textTheme
.
headline2
,
margin:
EdgeInsets
.
all
(
5
),
padding:
EdgeInsets
.
all
(
5
),
decoration:
BoxDecoration
(
color:
backgroundColor
,
borderRadius:
BorderRadius
.
circular
(
4
),
border:
Border
.
all
(
color:
borderColor
,
width:
4
,
),
),
child:
Text
(
myProvider
.
letter
,
style:
TextStyle
(
fontSize:
40
,
fontWeight:
FontWeight
.
w600
,
color:
Colors
.
black
,
),
),
RaisedButton
(
onPressed:
()
=
>
pickLetter
(
context
,
_myProvider
),
color:
Colors
.
orange
,
padding:
EdgeInsets
.
all
(
10.0
),
child:
Row
(
children:
<
Widget
>[
Icon
(
Icons
.
shuffle
),
Text
(
"Piocher une lettre"
)
],
),
),
),
),
],
],
),
),
SizedBox
(
height:
20
),
);
Column
(
}
Container
_buildPickedCategoryContainer
(
Data
myProvider
,
Color
backgroundColor
)
{
Color
borderColor
=
darken
(
backgroundColor
);
return
Container
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
children:
[
Text
(
_myProvider
.
category
,
style:
Theme
.
of
(
context
)
.
textTheme
.
headline3
,
),
FlatButton
(
FlatButton
(
onPressed:
()
=
>
pickCategory
(
context
,
_myProvider
),
onPressed:
()
=
>
pickCategory
(
myProvider
),
color:
Colors
.
orange
,
child:
Text
(
"🔀"
),
padding:
EdgeInsets
.
all
(
10.0
),
),
child:
Row
(
myProvider
.
category
==
''
?
null
:
Container
(
children:
<
Widget
>[
margin:
EdgeInsets
.
all
(
5
),
Icon
(
Icons
.
shuffle
),
padding:
EdgeInsets
.
all
(
5
),
Text
(
"Piocher une catégorie"
)
decoration:
BoxDecoration
(
],
color:
backgroundColor
,
borderRadius:
BorderRadius
.
circular
(
4
),
border:
Border
.
all
(
color:
borderColor
,
width:
4
,
),
),
child:
Text
(
myProvider
.
category
,
style:
TextStyle
(
fontSize:
40
,
fontWeight:
FontWeight
.
w600
,
color:
Colors
.
black
,
),
),
),
),
),
],
],
),
),
SizedBox
(
height:
40
),
);
Column
(
}
Container
_buildMiniGameContainer
(
Data
myProvider
,
Color
backgroundColor
)
{
Color
borderColor
=
darken
(
backgroundColor
);
return
Container
(
margin:
EdgeInsets
.
all
(
5
),
padding:
EdgeInsets
.
all
(
5
),
decoration:
BoxDecoration
(
color:
backgroundColor
,
borderRadius:
BorderRadius
.
circular
(
4
),
border:
Border
.
all
(
color:
borderColor
,
width:
4
,
),
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>
[
children:
[
FlatButton
(
FlatButton
(
onPressed:
(
_myProvider
.
countdown
!=
0
)
?
null
:
()
=
>
startMiniGame
(
context
,
_myProvider
),
onPressed:
(
myProvider
.
countdown
!=
0
)
?
null
:
()
=
>
startMiniGame
(
myProvider
),
color:
Colors
.
blue
,
padding:
EdgeInsets
.
all
(
10.0
),
padding:
EdgeInsets
.
all
(
10.0
),
child:
Row
(
child:
Text
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
(
myProvider
.
countdown
!=
0
)
?
myProvider
.
countdown
.
toString
()
:
'🎲'
,
children:
<
Widget
>[
style:
TextStyle
(
Text
(
fontSize:
50
,
_myProvider
.
countdown
.
toString
()
,
fontWeight:
FontWeight
.
w600
,
style:
Theme
.
of
(
context
)
.
textTheme
.
headline2
,
color:
Colors
.
black
,
),
),
],
),
),
),
),
],
],
),
),
);
}
@override
Widget
build
(
BuildContext
context
)
{
Data
_myProvider
=
Provider
.
of
<
Data
>(
context
);
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Petit bac'
),
),
body:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
_buildPickedLetterContainer
(
_myProvider
,
Colors
.
orange
),
SizedBox
(
height:
20
),
_buildPickedCategoryContainer
(
_myProvider
,
Colors
.
green
),
SizedBox
(
height:
40
),
_buildMiniGameContainer
(
_myProvider
,
Colors
.
blue
),
],
],
),
),
),
),
...
...
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