flutter: Adjust hint text format

This commit is contained in:
Calcitem 2021-04-11 23:15:44 +08:00
parent 836cd56f22
commit 6905e43e72
3 changed files with 65 additions and 27 deletions

View File

@ -564,13 +564,13 @@
"@player": {
"description": "player"
},
"player1": "Player 1",
"player1": "Player1",
"@player1": {
"description": "Player 1"
"description": "Player1"
},
"player2": "Player 2",
"player2": "Player2",
"@player2": {
"description": "Player 2"
"description": "Player2"
},
"howToPlay": "How to play",
"@howToPlay": {
@ -771,5 +771,17 @@
"developerMode": "Developer mode",
"@developerMode": {
"description": "Developer mode"
},
"pieceCount": "Piece count",
"@pieceCount": {
"description": "Piece count"
},
"inHand": "in hand",
"@inHand": {
"description": "in hand"
},
"onBoard": "on board",
"@onBoard": {
"description": "on board"
}
}

View File

@ -192,5 +192,8 @@
"timeout": "超时",
"personalization": "外观设置",
"forDevelopers": "开发者选项",
"developerMode": "开发者模式"
"developerMode": "开发者模式",
"pieceCount": "棋子数",
"inHand": "手上",
"onBoard": "棋盘上"
}

View File

@ -612,29 +612,54 @@ class _GamePageState extends State<GamePage> with RouteAware {
.showSnackBar(SnackBar(content: Text(message)));
}
String getHintText() {
String ret = S.of(context).score +
"\n" +
S.of(context).player1 +
": " +
Game.instance.position.score[PieceColor.black].toString() +
"\n" +
S.of(context).player2 +
": " +
Game.instance.position.score[PieceColor.white].toString() +
"\n" +
S.of(context).draw +
": " +
Game.instance.position.score[PieceColor.draw].toString() +
"\n\n" +
S.of(context).pieceCount +
"\n" +
S.of(context).player1 +
" " +
S.of(context).inHand +
": " +
Game.instance.position.pieceInHandCount[PieceColor.black].toString() +
"\n" +
S.of(context).player2 +
" " +
S.of(context).inHand +
": " +
Game.instance.position.pieceInHandCount[PieceColor.white].toString() +
"\n" +
S.of(context).player1 +
" " +
S.of(context).onBoard +
": " +
Game.instance.position.pieceOnBoardCount[PieceColor.black].toString() +
"\n" +
S.of(context).player2 +
" " +
S.of(context).onBoard +
": " +
Game.instance.position.pieceOnBoardCount[PieceColor.white].toString() +
"\n";
return ret;
}
Widget createToolbar() {
final manualText = Game.instance.position.manualText;
// TODO:
final analyzeText = "Score: " +
Game.instance.position.score[PieceColor.black].toString() +
" : " +
Game.instance.position.score[PieceColor.white].toString() +
" : " +
Game.instance.position.score[PieceColor.draw].toString() +
"\n" +
"Black has: " +
Game.instance.position.pieceInHandCount[PieceColor.black].toString() +
" pieces in hand\n" +
"White has: " +
Game.instance.position.pieceInHandCount[PieceColor.white].toString() +
" pieces in hand\n" +
"Black has: " +
Game.instance.position.pieceOnBoardCount[PieceColor.black].toString() +
" pieces on board\n" +
"White has: " +
Game.instance.position.pieceOnBoardCount[PieceColor.white].toString() +
" pieces on board\n";
final analyzeText = getHintText();
var newGameButton = TextButton(
child: Column(
@ -732,8 +757,6 @@ class _GamePageState extends State<GamePage> with RouteAware {
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: AppTheme.hintDialogackgroundColor,
title: Text(S.of(context).analyze,
style: TextStyle(color: AppTheme.hintTextColor)),
content: SingleChildScrollView(
child: Text(analyzeText, style: AppTheme.moveHistoryTextStyle)),
actions: <Widget>[