Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
org.benoitharrault.wordguessing
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.wordguessing
Commits
17a5e96e
Commit
17a5e96e
authored
4 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '24-add-score-counts-end-restart-game' into 'master'
Resolve "Add score / counts / end / restart game" Closes
#24
See merge request
!24
parents
7da0210c
0c0cfbd0
No related branches found
No related tags found
1 merge request
!24
Resolve "Add score / counts / end / restart game"
Pipeline
#1074
passed
4 years ago
Stage: update
Stage: build-debug
Changes
3
Pipelines
3
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
+29
-0
29 additions, 0 deletions
lib/provider/data.dart
lib/screens/game_pick_word.dart
+34
-3
34 additions, 3 deletions
lib/screens/game_pick_word.dart
with
65 additions
and
5 deletions
android/gradle.properties
+
2
−
2
View file @
17a5e96e
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.enableJetifier
=
true
app.versionName
=
0.0.2
2
app.versionCode
=
2
2
app.versionName
=
0.0.2
3
app.versionCode
=
2
3
This diff is collapsed.
Click to expand it.
lib/provider/data.dart
+
29
−
0
View file @
17a5e96e
...
...
@@ -7,6 +7,11 @@ class Data extends ChangeNotifier {
List
_otherWords
=
[];
List
_images
=
[];
// game data
int
_questionsCount
=
0
;
int
_goodAnswers
=
0
;
int
_wrongAnswers
=
0
;
String
get
word
=
>
_word
;
set
updateWord
(
String
value
)
{
...
...
@@ -32,6 +37,30 @@ class Data extends ChangeNotifier {
_word
=
''
;
_otherWords
=
[];
_images
=
[];
_questionsCount
=
0
;
_goodAnswers
=
0
;
_wrongAnswers
=
0
;
notifyListeners
();
}
int
get
questionsCount
=
>
_questionsCount
;
set
updateQuestionsCount
(
int
value
)
{
_questionsCount
=
value
;
notifyListeners
();
}
int
get
goodAnswers
=
>
_goodAnswers
;
set
updateGoodAnswers
(
int
value
)
{
_goodAnswers
=
value
;
notifyListeners
();
}
int
get
wrongAnswers
=
>
_wrongAnswers
;
set
updateWrongAnswers
(
int
value
)
{
_wrongAnswers
=
value
;
notifyListeners
();
}
}
This diff is collapsed.
Click to expand it.
lib/screens/game_pick_word.dart
+
34
−
3
View file @
17a5e96e
...
...
@@ -9,11 +9,15 @@ class GamePickWordPage extends StatelessWidget {
int
_count
=
4
;
Future
<
void
>
startGame
(
BuildContext
context
,
Data
myProvider
)
async
{
await
pickData
(
context
,
myProvider
);
myProvider
.
updateQuestionsCount
=
0
;
myProvider
.
updateGoodAnswers
=
0
;
myProvider
.
updateWrongAnswers
=
0
;
await
nextWord
(
context
,
myProvider
);
}
Future
<
void
>
nextWord
(
BuildContext
context
,
Data
myProvider
)
async
{
await
pickData
(
context
,
myProvider
);
myProvider
.
updateQuestionsCount
=
myProvider
.
questionsCount
+
1
;
}
Future
<
void
>
pickData
(
BuildContext
context
,
Data
myProvider
)
async
{
...
...
@@ -54,8 +58,33 @@ class GamePickWordPage extends StatelessWidget {
Future
<
void
>
checkWord
(
BuildContext
context
,
Data
myProvider
,
word
)
async
{
if
(
myProvider
.
word
==
word
)
{
myProvider
.
updateGoodAnswers
=
myProvider
.
goodAnswers
+
1
;
nextWord
(
context
,
myProvider
);
}
else
{
myProvider
.
updateWrongAnswers
=
myProvider
.
wrongAnswers
+
1
;
}
}
Container
_buildScoreContainer
(
BuildContext
context
,
Data
myProvider
)
{
String
score
=
''
+
'❓ '
+
myProvider
.
questionsCount
.
toString
()
+
' - '
+
'☺️ '
+
myProvider
.
goodAnswers
.
toString
()
+
' - '
+
'😟 '
+
myProvider
.
wrongAnswers
.
toString
()
;
return
Container
(
padding:
EdgeInsets
.
all
(
5
),
child:
Text
(
score
,
style:
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
w400
,
color:
Colors
.
black
,
),
),
);
}
Container
_buildImageContainer
(
String
image
,
Color
color
)
{
...
...
@@ -136,7 +165,7 @@ class GamePickWordPage extends StatelessWidget {
otherWords
.
length
>
2
?
otherWords
[
2
]
:
null
,
];
words
.
s
huffle
();
words
.
s
ort
();
return
Column
(
mainAxisSize:
MainAxisSize
.
min
,
...
...
@@ -205,9 +234,11 @@ class GamePickWordPage extends StatelessWidget {
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
_buildImageItemsBlock
(
_myProvider
.
images
),
SizedBox
(
height:
5
),
_buildScoreContainer
(
context
,
_myProvider
),
((
_myProvider
.
word
==
null
)
||
(
_myProvider
.
word
==
''
))
?
_buildStartGameButton
(
context
,
_myProvider
)
:
SizedBox
(
height:
1
5
),
SizedBox
(
height:
5
),
_buildTextItemsBlock
(
context
,
_myProvider
,
_myProvider
.
word
,
_myProvider
.
otherWords
),
],
),
...
...
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