Skip to content
Snippets Groups Projects
Commit e1105405 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Display word if not found when game ends

parent 21454327
Branches
Tags
1 merge request!25Resolve "Display word when game ends"
Pipeline #3580 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.20
app.versionCode=20
app.versionName=0.0.21
app.versionCode=21
Display word if not found when the game ends
Affichage du mot à deviner s'il n'est pas trouvé à la fin de la partie
......@@ -102,6 +102,17 @@ class Board {
tableRows.add(TableRow(children: tableCells));
}
List<Widget> gameBoard = [
Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
border: TableBorder.all(
color: Colors.white,
style: BorderStyle.none,
),
children: tableRows,
),
];
double horizontalMargins = 20;
if (wordLength < 6) {
horizontalMargins = 40;
......@@ -110,16 +121,21 @@ class Board {
}
}
if (myProvider.isGameFinished() && !myProvider.gameWon) {
gameBoard.add(Text(
myProvider.word,
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
),
));
}
return Container(
margin: EdgeInsets.symmetric(horizontal: horizontalMargins),
padding: EdgeInsets.all(2),
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
border: TableBorder.all(
color: Colors.white,
style: BorderStyle.none,
),
children: tableRows,
child: Column(
children: gameBoard,
),
);
}
......
......@@ -198,9 +198,7 @@ class Data extends ChangeNotifier {
}
bool isGameFinished() {
print('isGameFinished');
if (_foundWord || (_guesses.length > (_maxGuessesCount - 1))) {
if (_foundWord || (_guesses.length >= _maxGuessesCount)) {
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment