flutter: Change new game from AlertDialog to SimpleDialog

This commit is contained in:
Calcitem 2021-04-11 20:59:09 +08:00
parent db81c3c2fe
commit fabbaa2460
3 changed files with 16 additions and 9 deletions

View File

@ -33,7 +33,7 @@
"draw": "和棋",
"thinking": "对方思考中...",
"newGame": "新局",
"startNewGame": "重新开局",
"startNewGame": "开始新局",
"restartGame": "重新开局?",
"restart": "重开局",
"gameStarted": "游戏开始 请落子",

View File

@ -26,6 +26,7 @@ class AppTheme {
static var moveHistoryDialogBackgroundColor = Colors.transparent;
static var hintDialogackgroundColor = moveHistoryDialogBackgroundColor;
static var hintTextColor = moveHistoryTextColor;
static var simpleDialogOptionTextColor = appPrimaryColor;
/// Settings page
static var darkBackgroundColor = UIColors.crusoe;
@ -99,9 +100,15 @@ class AppTheme {
fontWeight: FontWeight.w600,
);
static var simpleDialogOptionTextStyle = TextStyle(
fontSize: AppTheme.simpleDialogOptionFontSize,
color: AppTheme.simpleDialogOptionTextColor,
);
static var moveHistoryTextStyle =
TextStyle(fontSize: 18, height: 1.5, color: moveHistoryTextColor);
static double simpleDialogOptionFontSize = 20.0;
static double gamePageTopMargin = 28.0;
static double boardMargin = 10.0;
static double boardScreenPaddingH = 10.0;

View File

@ -323,14 +323,14 @@ class _GamePageState extends State<GamePage> with RouteAware {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(S.of(context).newGame,
style: TextStyle(color: AppTheme.dialogTitleColor)),
content:
SingleChildScrollView(child: Text(S.of(context).restartGame)),
actions: <Widget>[
TextButton(child: Text(S.of(context).restart), onPressed: confirm),
TextButton(child: Text(S.of(context).cancel), onPressed: cancel),
return SimpleDialog(
children: <Widget>[
SimpleDialogOption(
child: Text(
S.of(context).startNewGame,
style: AppTheme.simpleDialogOptionTextStyle,
),
onPressed: confirm),
],
);
},