flutter: settings: Support Message Color
This commit is contained in:
parent
b869e7a0f5
commit
62f8b4f2c7
|
@ -59,6 +59,7 @@ class Config {
|
|||
static int boardBackgroundColor = AppTheme.boardBackgroundColor.value;
|
||||
static int whitePieceColor = AppTheme.whitePieceColor.value;
|
||||
static int blackPieceColor = AppTheme.blackPieceColor.value;
|
||||
static int messageColor = AppTheme.messageColor.value;
|
||||
|
||||
// Rules
|
||||
static int piecesCount = 9;
|
||||
|
@ -121,6 +122,8 @@ class Config {
|
|||
settings['WhitePieceColor'] ?? AppTheme.whitePieceColor.value;
|
||||
Config.blackPieceColor =
|
||||
settings['BlackPieceColor'] ?? AppTheme.blackPieceColor.value;
|
||||
Config.messageColor =
|
||||
settings['MessageColor'] ?? AppTheme.messageColor.value;
|
||||
|
||||
// Rules
|
||||
rule.piecesCount = Config.piecesCount = settings['PiecesCount'] ?? 9;
|
||||
|
@ -188,6 +191,7 @@ class Config {
|
|||
settings['BoardBackgroundColor'] = Config.boardBackgroundColor;
|
||||
settings['WhitePieceColor'] = Config.whitePieceColor;
|
||||
settings['BlackPieceColor'] = Config.blackPieceColor;
|
||||
settings['MessageColor'] = Config.messageColor;
|
||||
|
||||
// Rules
|
||||
settings['PiecesCount'] = Config.piecesCount;
|
||||
|
|
|
@ -600,6 +600,10 @@
|
|||
"@blackPieceColor": {
|
||||
"description": "Player 2 piece color"
|
||||
},
|
||||
"messageColor": "Nachrichtenfarbe",
|
||||
"@messageColor": {
|
||||
"description": "Message color"
|
||||
},
|
||||
"aiIsLazy": "Computer ist faul",
|
||||
"@aiIsLazy": {
|
||||
"description": "AI is Lazy"
|
||||
|
|
|
@ -600,6 +600,10 @@
|
|||
"@blackPieceColor": {
|
||||
"description": "Player 2 piece color"
|
||||
},
|
||||
"messageColor": "Message color",
|
||||
"@messageColor": {
|
||||
"description": "Message color"
|
||||
},
|
||||
"aiIsLazy": "AI is Lazy",
|
||||
"@aiIsLazy": {
|
||||
"description": "AI is Lazy"
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
"lineColor": "线条颜色",
|
||||
"whitePieceColor": "先手方棋子颜色",
|
||||
"blackPieceColor": "后手方棋子颜色",
|
||||
"messageColor": "提示信息颜色",
|
||||
"aiIsLazy": "机器领先时懒惰",
|
||||
"isPieceCountInHandShown": "显示手中剩余棋子数",
|
||||
"isNotationsShown": "棋盘边缘显示坐标",
|
||||
|
|
|
@ -11,13 +11,13 @@ class AppTheme {
|
|||
|
||||
/// Game page
|
||||
static var gamePageHeaderIconColor = Colors.white;
|
||||
static var tipTextColor = Colors.white;
|
||||
static var boardBackgroundColor = UIColors.burlyWood;
|
||||
static var boardLineColor = Color(0x996D000D);
|
||||
static var blackPieceColor = Color.fromARGB(0xFF, 0x00, 0x00, 0x00);
|
||||
static var blackPieceBorderColor = Color.fromARGB(0xFF, 0x22, 0x22, 0x22);
|
||||
static var whitePieceColor = Color.fromARGB(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
static var whitePieceBorderColor = Color.fromARGB(0xFF, 0x66, 0x00, 0x00);
|
||||
static var messageColor = Colors.white;
|
||||
static var banColor = Color.fromARGB(0xFF, 0xFF, 0x00, 0x00); // unused
|
||||
static var banBorderColor = Color.fromARGB(0x80, 0xFF, 0x00, 0x00); // unused
|
||||
static var toolbarIconColor = listTileSubtitleColor;
|
||||
|
@ -115,8 +115,6 @@ class AppTheme {
|
|||
static double boardBorderRadius = 5.0;
|
||||
static double boardPadding = 5.0;
|
||||
|
||||
static var gamePageTipStyle = TextStyle(fontSize: 16, color: tipTextColor);
|
||||
|
||||
static const settingsHeaderStyle =
|
||||
TextStyle(color: settingsHeaderTextColor, fontSize: 20.0);
|
||||
|
||||
|
|
|
@ -1112,7 +1112,11 @@ class _GamePageState extends State<GamePage>
|
|||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(_tip!, maxLines: 1, style: AppTheme.gamePageTipStyle),
|
||||
child: Text(
|
||||
_tip!,
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 16, color: Color(Config.messageColor)),
|
||||
), // TODO: Font Size
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -56,6 +56,7 @@ class _PersonalizationSettingsPageState
|
|||
S.of(context).lineColor: Config.boardLineColor,
|
||||
S.of(context).whitePieceColor: Config.whitePieceColor,
|
||||
S.of(context).blackPieceColor: Config.blackPieceColor,
|
||||
S.of(context).messageColor: Config.messageColor,
|
||||
};
|
||||
|
||||
AlertDialog alert = AlertDialog(
|
||||
|
@ -85,6 +86,8 @@ class _PersonalizationSettingsPageState
|
|||
Config.whitePieceColor = pickerColor.value;
|
||||
} else if (colorString == S.of(context).blackPieceColor) {
|
||||
Config.blackPieceColor = pickerColor.value;
|
||||
} else if (colorString == S.of(context).messageColor) {
|
||||
Config.messageColor = pickerColor.value;
|
||||
}
|
||||
|
||||
Config.save();
|
||||
|
@ -378,6 +381,13 @@ class _PersonalizationSettingsPageState
|
|||
trailingColor: Config.blackPieceColor,
|
||||
onTap: () => showColorDialog(S.of(context).blackPieceColor),
|
||||
),
|
||||
ListItemDivider(),
|
||||
SettingsListTile(
|
||||
context: context,
|
||||
titleString: S.of(context).messageColor,
|
||||
trailingColor: Config.messageColor,
|
||||
onTap: () => showColorDialog(S.of(context).messageColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue