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

Display current typing cell

parent 41c5ff68
No related branches found
No related tags found
1 merge request!24Resolve "Display typing cell"
Pipeline #3565 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