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

Improve layout

parent c9817318
No related branches found
No related tags found
1 merge request!6Resolve "Improve layout"
Pipeline #2544 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.1
app.versionCode=1
app.versionName=0.0.2
app.versionCode=2
assets/icons/key.png

2.6 KiB

......@@ -58,6 +58,7 @@ build_icon ${CURRENT_DIR}/button_back.svg ${BASE_DIR}/assets/icons/button_back
build_icon ${CURRENT_DIR}/button_help.svg ${BASE_DIR}/assets/icons/button_help.png
build_icon ${CURRENT_DIR}/button_start.svg ${BASE_DIR}/assets/icons/button_start.png
build_icon ${CURRENT_DIR}/game_win.svg ${BASE_DIR}/assets/icons/game_win.png
build_icon ${CURRENT_DIR}/key.svg ${BASE_DIR}/assets/icons/key.png
build_icon ${CURRENT_DIR}/lang_fr.svg ${BASE_DIR}/assets/icons/lang_fr.png
build_icon ${CURRENT_DIR}/length_5.svg ${BASE_DIR}/assets/icons/length_5.png
......
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 102 102" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><defs><radialGradient id="radialGradient1525" cx="28.886" cy="23.061" r="50.92" gradientTransform="matrix(1.0318 1.378 -.79998 .59897 23.21 -30.64)" gradientUnits="userSpaceOnUse"><stop stop-color="#adadad" offset="0"/><stop stop-color="#e8e8e8" offset="1"/></radialGradient></defs><rect x=".17153" y=".2307" width="101.84" height="101.77" ry="0" fill="url(#radialGradient1525)" stroke="#000" stroke-width="2.0362"/></svg>
......@@ -57,7 +57,7 @@ class Board {
List<String> tips = GameUtils.getTips(myProvider, word);
List<Column> tableCells = [];
List<TableCell> tableCells = [];
for (int colIndex = 0; colIndex < wordLength; colIndex++) {
String cellValue = ' ';
if (word.length > colIndex) {
......@@ -70,8 +70,8 @@ class Board {
}
tableCells.add(
Column(
children: [ buildCellWidget(cellValue, cellTip) ]
TableCell(
child: buildCellWidget(cellValue, cellTip)
)
);
};
......@@ -83,7 +83,7 @@ class Board {
}
return Container(
margin: EdgeInsets.symmetric(horizontal: 30),
margin: EdgeInsets.symmetric(horizontal: 40),
padding: EdgeInsets.all(2),
child: Table(
......
......@@ -27,8 +27,8 @@ class Game {
);
}
static FlatButton buildRestartGameButton(Data myProvider) {
return FlatButton(
static TextButton buildRestartGameButton(Data myProvider) {
return TextButton(
child: Container(
child: Image(
image: AssetImage('assets/icons/button_back.png'),
......
......@@ -15,18 +15,33 @@ class Keyboard {
];
Widget buildKeyWidget(String key) {
String displayedText = key;
String keyText = key;
if (key == '<') {
displayedText = '⬅️';
keyText = '⬅️';
} else if (key == '!') {
displayedText = '☑️';
keyText = '☑️';
}
Color keyColor = Colors.black;
return FlatButton(
if (key == ' ') {
return SizedBox();
}
return Stack(
alignment: Alignment.center,
children: <Widget>[
Image(
image: AssetImage('assets/icons/key.png'),
fit: BoxFit.fill
),
Center(
child: TextButton(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(0),
),
child: Text(
displayedText,
keyText,
style: TextStyle(
color: keyColor,
fontSize: 30.0,
......@@ -43,16 +58,19 @@ class Keyboard {
GameUtils.addLetter(myProvider, key);
}
},
)
),
]
);
}
List<TableRow> tableRows = [];
keys.forEach((row) {
List<Column> tableCells = [];
List<TableCell> tableCells = [];
row.forEach((key) {
tableCells.add(
Column(
children: [ buildKeyWidget(key) ]
TableCell(
child: buildKeyWidget(key),
)
);
});
......@@ -68,12 +86,12 @@ class Keyboard {
padding: EdgeInsets.all(2),
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.bottom,
border: TableBorder.all(
width: 2.0,
color: Colors.blue,
style: BorderStyle.solid,
),
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
// border: TableBorder.all(
// width: 2.0,
// color: Colors.blue,
// style: BorderStyle.solid,
// ),
children: tableRows,
)
);
......
......@@ -48,7 +48,7 @@ class Parameters {
decorationImage,
Column(
children: [
FlatButton(
TextButton(
child: Container(
child: Image(
image: AssetImage('assets/icons/button_start.png'),
......@@ -91,15 +91,15 @@ class Parameters {
);
}
static FlatButton _buildParameterButton(Data myProvider, String parameterCode, String parameterValue) {
static TextButton _buildParameterButton(Data myProvider, String parameterCode, String parameterValue) {
String currentValue = myProvider.getParameterValue(parameterCode).toString();
bool isActive = (parameterValue == currentValue);
String imageAsset = 'assets/icons/' + parameterCode + '_' + parameterValue + '.png';
return FlatButton(
padding: EdgeInsets.all(2),
return TextButton(
child: Container(
padding: EdgeInsets.all(2),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
......
......@@ -31,7 +31,7 @@ class _HomeState extends State<Home> {
if (myProvider.gameIsRunning) {
menuActions = [
FlatButton(
TextButton(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment