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