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

Merge branch '30-display-typing-cell' into 'master'

Resolve "Display typing cell"

Closes #30

See merge request !24
parents 41c5ff68 afe39507
Branches
Tags Release_0.0.19_19
1 merge request!24Resolve "Display typing cell"
Pipeline #3568 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.18
app.versionCode=18
app.versionName=0.0.19
app.versionCode=19
Display current typing cell
Mise en évidence de la case en cours de saisie
......@@ -10,8 +10,10 @@ class Board {
int maxGuessesCount = myProvider.maxGuessesCount;
int wordLength = int.parse(myProvider.length);
Widget buildCellWidget(String cellValue, String cellTip) {
Widget buildCellWidget(String cellValue, String cellTip, bool hasFocus) {
Color textColor = Colors.white;
Color focusBorderColor = Colors.yellow.shade700;
Color defaultBorderColor = Colors.white;
String cellImage = 'empty';
if (cellTip != '') {
......@@ -23,6 +25,17 @@ class Board {
fit: BoxFit.fill,
);
Widget cellBackground = Container(
decoration: BoxDecoration(
border: Border.all(
width: 4.0,
color: hasFocus ? focusBorderColor : defaultBorderColor,
style: BorderStyle.solid,
),
),
child: imageWidget,
);
Text textWidget = Text(
cellValue,
style: TextStyle(
......@@ -36,7 +49,7 @@ class Board {
return Stack(
alignment: Alignment.center,
children: <Widget>[
imageWidget,
cellBackground,
Center(child: textWidget),
],
);
......@@ -67,7 +80,11 @@ class Board {
cellTip = tips[colIndex];
}
tableCells.add(TableCell(child: buildCellWidget(cellValue, cellTip)));
bool hasFocus = (!myProvider.gameWon) &&
(lineIndex == guesses.length) &&
(colIndex == word.length);
tableCells.add(TableCell(child: buildCellWidget(cellValue, cellTip, hasFocus)));
}
tableRows.add(TableRow(children: tableCells));
......@@ -87,9 +104,8 @@ class Board {
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
border: TableBorder.all(
width: 2.0,
color: Colors.white,
style: BorderStyle.solid,
style: BorderStyle.none,
),
children: tableRows,
),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment