info: Show period and comma only when screenReaderSupport is enabled

This commit is contained in:
Calcitem 2021-09-04 23:49:31 +08:00
parent af25423d4e
commit ccee0de09f
No known key found for this signature in database
GPG Key ID: F2F7C29E054CFB80
1 changed files with 29 additions and 13 deletions

View File

@ -1534,6 +1534,8 @@ class _GamePageState extends State<GamePage>
String getInfoText() { String getInfoText() {
String phase = ""; String phase = "";
String period = Config.screenReaderSupport ? "." : "";
String comma = Config.screenReaderSupport ? "," : "";
var pos = Game.instance.position; var pos = Game.instance.position;
@ -1554,13 +1556,15 @@ class _GamePageState extends State<GamePage>
S.of(context).inHand + S.of(context).inHand +
": " + ": " +
pos.pieceInHandCount[PieceColor.white].toString() + pos.pieceInHandCount[PieceColor.white].toString() +
",\n" + comma +
"\n" +
S.of(context).player2 + S.of(context).player2 +
" " + " " +
S.of(context).inHand + S.of(context).inHand +
": " + ": " +
pos.pieceInHandCount[PieceColor.black].toString() + pos.pieceInHandCount[PieceColor.black].toString() +
",\n" comma +
"\n"
: ""; : "";
String us = ""; String us = "";
@ -1588,22 +1592,30 @@ class _GamePageState extends State<GamePage>
lastMove = n1; lastMove = n1;
} }
if (Config.screenReaderSupport) { if (Config.screenReaderSupport) {
lastMove = lastMove = S.of(context).lastMove +
S.of(context).lastMove + ": " + them + ", " + lastMove + ".\n"; ": " +
them +
", " +
lastMove +
period +
"\n";
} else { } else {
lastMove = S.of(context).lastMove + ": " + lastMove + ".\n"; lastMove = S.of(context).lastMove + ": " + lastMove + period + "\n";
} }
} }
String ret = phase + String ret = phase +
".\n" + period +
"\n" +
lastMove + lastMove +
S.of(context).sideToMove + S.of(context).sideToMove +
": " + ": " +
us + us +
". " + period +
tip + tip +
"\n\n" + "\n" +
period +
"\n" +
S.of(context).pieceCount + S.of(context).pieceCount +
":\n" + ":\n" +
pieceCountInHand + pieceCountInHand +
@ -1612,27 +1624,31 @@ class _GamePageState extends State<GamePage>
S.of(context).onBoard + S.of(context).onBoard +
": " + ": " +
pos.pieceOnBoardCount[PieceColor.white].toString() + pos.pieceOnBoardCount[PieceColor.white].toString() +
",\n" + comma +
"\n" +
S.of(context).player2 + S.of(context).player2 +
" " + " " +
S.of(context).onBoard + S.of(context).onBoard +
": " + ": " +
pos.pieceOnBoardCount[PieceColor.black].toString() + pos.pieceOnBoardCount[PieceColor.black].toString() +
".\n\n" + period +
"\n\n" +
S.of(context).score + S.of(context).score +
":\n" + ":\n" +
S.of(context).player1 + S.of(context).player1 +
": " + ": " +
pos.score[PieceColor.white].toString() + pos.score[PieceColor.white].toString() +
",\n" + comma +
"\n" +
S.of(context).player2 + S.of(context).player2 +
": " + ": " +
pos.score[PieceColor.black].toString() + pos.score[PieceColor.black].toString() +
",\n" + comma +
"\n" +
S.of(context).draw + S.of(context).draw +
": " + ": " +
pos.score[PieceColor.draw].toString() + pos.score[PieceColor.draw].toString() +
"."; period;
return ret; return ret;
} }