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": "和棋", "draw": "和棋",
"thinking": "对方思考中...", "thinking": "对方思考中...",
"newGame": "新局", "newGame": "新局",
"startNewGame": "重新开局", "startNewGame": "开始新局",
"restartGame": "重新开局?", "restartGame": "重新开局?",
"restart": "重开局", "restart": "重开局",
"gameStarted": "游戏开始 请落子", "gameStarted": "游戏开始 请落子",

View File

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

View File

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