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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
android
org.benoitharrault.wordguessing
Commits
58238f44
Commit
58238f44
authored
Apr 16, 2021
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '3-setup-words-list' into 'master'
Resolve "Setup words list" Closes
#3
See merge request
!5
parents
d0f46a0e
06b1921b
No related branches found
No related tags found
1 merge request
!5
Resolve "Setup words list"
Pipeline
#932
passed
Apr 16, 2021
Stage: update
Stage: build-debug
Stage: build-release
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
assets/files/words-fr.json
+99
-0
99 additions, 0 deletions
assets/files/words-fr.json
lib/utils/random_pick_word.dart
+31
-0
31 additions, 0 deletions
lib/utils/random_pick_word.dart
pubspec.yaml
+2
-0
2 additions, 0 deletions
pubspec.yaml
with
132 additions
and
0 deletions
assets/files/words-fr.json
0 → 100644
+
99
−
0
View file @
58238f44
{
"words"
:
[
"ANACONDA"
,
"AUTRUCHE"
,
"BARRACUDA"
,
"BOUQUETIN"
,
"COCCINELLE"
,
"CROCODILE"
,
"DROMADAIRE"
,
"ELEPHANT"
,
"ESCARGOT"
,
"FOURMILIER"
,
"GRENOUILLE"
,
"HIPPOCAMPE"
,
"HIPPOPOTAME"
,
"KANGOUROU"
,
"LIBELLULE"
,
"PERROQUET"
,
"PIPISTRELLE"
,
"RHINOCEROS"
,
"SAUTERELLE"
,
"TARENTULE"
,
"AUBERGINE"
,
"BETTERAVE"
,
"CITROUILLE"
,
"CONCOMBRE"
,
"FRAMBOISE"
,
"GROSEILLE"
,
"MANDARINE"
,
"MIRABELLE"
,
"MYRTILLE"
,
"PAMPLEMOUSSE"
,
"ROUGE"
,
"BLEU"
,
"VERT"
,
"JAUNE"
,
"VIOLET"
,
"ORANGE"
,
"MARRON"
,
"NOIR"
,
"BLANC"
,
"TURQUOISE"
,
"BEIGE"
,
"ROSE"
,
"PIVOINE"
,
"TULIPE"
,
"JONQUILLE"
,
"CACTUS"
,
"GYMNASTIQUE"
,
"FOOTBALL"
,
"HANDBALL"
,
"COURSE"
,
"CYCLISME"
,
"RANDONNEE"
,
"FROMAGE"
,
"PIZZA"
,
"SAUCISSON"
,
"JAMBON"
,
"SALAMI"
,
"PAELLA"
,
"PATES"
,
"SALADE"
,
"SOUPE"
,
"CHOCOLAT"
,
"OEUF"
,
"CREME"
,
"LAIT"
,
"CORNICHON"
,
"FLAN"
,
"TARTE"
,
"PUREE"
,
"SAUMON"
,
"SANDWICH"
,
"VOITURE"
,
"MOTO"
,
"VELO"
,
"TRAIN"
,
"BATEAU"
,
"AVION"
,
"HELICOPTERE"
,
"AUTOBUS"
,
"CAR"
,
"TRAINEAU"
,
"FUSEE"
,
"VOILIER"
,
"PAQUEBOT"
,
"METRO"
,
"SOUS-MARIN"
,
"CAMION"
,
"TRACTEUR"
,
"KAYAK"
]
}
This diff is collapsed.
Click to expand it.
lib/utils/random_pick_word.dart
0 → 100644
+
31
−
0
View file @
58238f44
import
'dart:async'
;
import
'dart:convert'
;
import
'package:flutter/services.dart'
;
import
'dart:math'
show
Random
;
class
RandomPickWord
{
RandomPickWord
();
String
_word
;
final
random
=
Random
();
init
()
async
{
await
wordFromLocalFile
();
}
Future
<
void
>
wordFromLocalFile
()
async
{
String
jsonString
;
try
{
jsonString
=
await
rootBundle
.
loadString
(
'assets/files/words-fr.json'
);
final
jsonResponse
=
await
json
.
decode
(
jsonString
);
var
wordList
=
jsonResponse
[
jsonResponse
.
keys
.
toList
()
.
join
()];
int
randomWordIndex
=
random
.
nextInt
(
wordList
.
length
);
String
word
=
wordList
[
random
.
nextInt
(
wordList
.
length
)];
_word
=
word
??
'UNEXPECTED ERROR'
;
}
catch
(
e
)
{
_word
=
'UNEXPECTED ERROR'
;
}
}
String
get
word
=
>
_word
;
}
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
2
−
0
View file @
58238f44
...
...
@@ -17,3 +17,5 @@ dev_dependencies:
flutter
:
uses-material-design
:
true
assets
:
-
assets/files/
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
sign in
to comment