Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
org.benoitharrault.momomotus
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.momomotus
Commits
12d26adc
Commit
12d26adc
authored
3 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '22-fix-get-word-after-length-change' into 'master'
Resolve "Fix get word after length change" Closes
#22
See merge request
!14
parents
e3f859c4
17f0816f
No related branches found
No related tags found
1 merge request
!14
Resolve "Fix get word after length change"
Pipeline
#2598
passed
3 years ago
Stage: update
Stage: build-debug
Changes
2
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
android/gradle.properties
+2
-2
2 additions, 2 deletions
android/gradle.properties
lib/utils/random_pick_word.dart
+13
-11
13 additions, 11 deletions
lib/utils/random_pick_word.dart
with
15 additions
and
13 deletions
android/gradle.properties
+
2
−
2
View file @
12d26adc
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/utils/random_pick_word.dart
+
13
−
11
View file @
12d26adc
...
...
@@ -7,6 +7,8 @@ import 'package:flutter/services.dart';
class
RandomPickWord
{
static
Set
<
String
>
wordList
=
<
String
>{};
static
Set
<
String
>
dictionary
=
<
String
>{};
static
String
_lang
=
''
;
static
int
_length
=
5
;
static
String
_level
=
''
;
...
...
@@ -16,22 +18,18 @@ class RandomPickWord {
String
get
word
=
>
_word
;
init
(
String
lang
,
int
length
,
String
level
)
async
{
if
(
lang
!=
_lang
||
length
!=
_length
||
level
!=
_level
||
wordList
.
isEmpty
||
dictionary
.
isEmpty
)
{
_lang
=
lang
;
_length
=
length
;
_level
=
level
;
_word
=
''
;
await
wordFromLocalFile
(
lang
,
length
,
level
);
}
Future
<
void
>
wordFromLocalFile
(
String
lang
,
int
length
,
String
level
)
async
{
if
(
length
!=
_length
||
level
!=
_level
||
wordList
.
isEmpty
||
dictionary
.
isEmpty
)
{
_length
=
length
;
_level
=
level
;
dictionary
.
clear
();
wordList
.
clear
();
String
wordBaseFilename
=
'words-'
+
length
.
toString
()
+
'-'
+
lang
;
// Get full dictionary (eligible words)
print
(
'Reload dictionary
'
);
print
(
'Reload dictionary
/ '
+
lang
+
' / '
+
length
.
toString
()
);
try
{
String
wordsFile
=
wordBaseFilename
+
'-'
+
'dictionary'
;
var
data
=
await
rootBundle
.
loadString
(
'assets/files/'
+
wordsFile
+
'.txt'
);
...
...
@@ -45,7 +43,7 @@ class RandomPickWord {
}
// Get guessable words list (will pick random word from)
print
(
'Reload words list
('
+
level
+
')'
);
print
(
'Reload words list
/ '
+
lang
+
' / '
+
length
.
toString
()
+
' / '
+
level
);
try
{
String
wordsFile
=
wordBaseFilename
+
'-'
+
level
;
var
data
=
await
rootBundle
.
loadString
(
'assets/files/'
+
wordsFile
+
'.txt'
);
...
...
@@ -57,12 +55,16 @@ class RandomPickWord {
}
catch
(
e
)
{
throw
"Failed loading words database"
;
}
}
print
(
'Words in dictionary: '
+
dictionary
.
length
.
toString
());
print
(
'Words in words list: '
+
wordList
.
length
.
toString
());
_word
=
''
;
await
wordFromLocalFile
();
}
Future
<
void
>
wordFromLocalFile
()
async
{
// Check we have enough words
if
(
wordList
.
length
<
1
)
{
print
(
'Not enough words in list.'
);
...
...
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