flutter: 对战页面标题能正常显示对战模式了
This commit is contained in:
parent
da2ccb32e4
commit
1a576ba82a
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import 'package:sanmill/mill/position.dart';
|
import 'package:sanmill/mill/position.dart';
|
||||||
|
|
||||||
enum EngineType { humanVsCloud, humanVsAi, humanVsHuman, aiVsAi }
|
enum EngineType { humanVsAi, humanVsHuman, aiVsAi, humanVsCloud }
|
||||||
|
|
||||||
class EngineResponse {
|
class EngineResponse {
|
||||||
final String type;
|
final String type;
|
||||||
|
|
|
@ -2,5 +2,21 @@
|
||||||
"appName": "Mill Game",
|
"appName": "Mill Game",
|
||||||
"@appName": {
|
"@appName": {
|
||||||
"description": "The App name"
|
"description": "The App name"
|
||||||
|
},
|
||||||
|
"humanVsAi": "Human Vs AI",
|
||||||
|
"@humanVsAi": {
|
||||||
|
"description": "Human Vs AI"
|
||||||
|
},
|
||||||
|
"humanVsHuman": "Human Vs Human",
|
||||||
|
"@humanVsHuman": {
|
||||||
|
"description": "Human Vs Human"
|
||||||
|
},
|
||||||
|
"aiVsAi": "AI Vs AI",
|
||||||
|
"@aiVsAi": {
|
||||||
|
"description": "AI Vs AI"
|
||||||
|
},
|
||||||
|
"humanVsCloud": "Human Vs Cloud",
|
||||||
|
"@humanVsCloud": {
|
||||||
|
"description": "Human Vs Cloud"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,7 @@
|
||||||
{
|
{
|
||||||
"appName": "直棋"
|
"appName": "直棋",
|
||||||
|
"humanVsAi": "人机对战",
|
||||||
|
"humanVsHuman": "双人对战",
|
||||||
|
"aiVsAi": "机器对战",
|
||||||
|
"humanVsCloud": "挑战云端"
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:sanmill/engine/analyze.dart';
|
import 'package:sanmill/engine/analyze.dart';
|
||||||
import 'package:sanmill/engine/engine.dart';
|
import 'package:sanmill/engine/engine.dart';
|
||||||
import 'package:sanmill/engine/native_engine.dart';
|
import 'package:sanmill/engine/native_engine.dart';
|
||||||
|
import 'package:sanmill/generated/l10n.dart';
|
||||||
import 'package:sanmill/main.dart';
|
import 'package:sanmill/main.dart';
|
||||||
import 'package:sanmill/mill/game.dart';
|
import 'package:sanmill/mill/game.dart';
|
||||||
import 'package:sanmill/mill/mill.dart';
|
import 'package:sanmill/mill/mill.dart';
|
||||||
|
@ -428,7 +429,13 @@ class _GamePageState extends State<GamePage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget createPageHeader() {
|
Widget createPageHeader() {
|
||||||
//
|
Map<EngineType, String> engineTypeToString = {
|
||||||
|
EngineType.humanVsAi: S.of(context).humanVsAi,
|
||||||
|
EngineType.humanVsHuman: S.of(context).humanVsHuman,
|
||||||
|
EngineType.aiVsAi: S.of(context).aiVsAi,
|
||||||
|
EngineType.humanVsCloud: S.of(context).humanVsCloud,
|
||||||
|
};
|
||||||
|
|
||||||
final titleStyle =
|
final titleStyle =
|
||||||
TextStyle(fontSize: 28, color: UIColors.darkTextPrimaryColor);
|
TextStyle(fontSize: 28, color: UIColors.darkTextPrimaryColor);
|
||||||
final subTitleStyle =
|
final subTitleStyle =
|
||||||
|
@ -448,11 +455,7 @@ class _GamePageState extends State<GamePage> {
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
Hero(tag: 'logo', child: Image.asset('images/logo-mini.png')),
|
Hero(tag: 'logo', child: Image.asset('images/logo-mini.png')),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
Text(
|
Text(engineTypeToString[widget.engineType], style: titleStyle),
|
||||||
widget.engineType == EngineType.humanVsCloud
|
|
||||||
? '挑战云主机'
|
|
||||||
: '人机对战',
|
|
||||||
style: titleStyle),
|
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon:
|
icon:
|
||||||
|
|
|
@ -121,29 +121,29 @@ class _MainMenuState extends State<MainMenu> with TickerProviderStateMixin {
|
||||||
),
|
),
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text('人机对战', style: menuItemStyle),
|
child: Text(S.of(context).humanVsAi, style: menuItemStyle),
|
||||||
onPressed: () => navigateTo(GamePage(EngineType.humanVsAi)),
|
onPressed: () => navigateTo(GamePage(EngineType.humanVsAi)),
|
||||||
),
|
),
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text('双人对战', style: menuItemStyle),
|
child: Text(S.of(context).humanVsHuman, style: menuItemStyle),
|
||||||
onPressed: () => navigateTo(GamePage(EngineType.humanVsHuman)),
|
onPressed: () => navigateTo(GamePage(EngineType.humanVsHuman)),
|
||||||
),
|
),
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text('机器对战', style: menuItemStyle),
|
child: Text(S.of(context).aiVsAi, style: menuItemStyle),
|
||||||
onPressed: () => navigateTo(GamePage(EngineType.aiVsAi)),
|
onPressed: () => navigateTo(GamePage(EngineType.aiVsAi)),
|
||||||
),
|
),
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
Text(
|
Text(
|
||||||
' 健康游戏忠告\n'
|
' ??????\n'
|
||||||
'抵制不良游戏,拒绝盗版游戏。\n'
|
'??????,???????\n'
|
||||||
'注意自我保护,谨防受骗上当。\n'
|
'??????,???????\n'
|
||||||
'适度游戏益脑,沉迷游戏伤身。\n'
|
'??????,???????\n'
|
||||||
'合理安排时间,享受健康生活。',
|
'??????,???????',
|
||||||
style: TextStyle(color: Colors.black54, fontSize: 16)),
|
style: TextStyle(color: Colors.black54, fontSize: 16)),
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
Text('Copyright © 2019-2020 The Sanmill Authors',
|
Text('Copyright © 2019-2020 The Sanmill Authors',
|
||||||
style: TextStyle(color: Colors.black54, fontSize: 16)),
|
style: TextStyle(color: Colors.black54, fontSize: 16)),
|
||||||
Expanded(child: SizedBox()),
|
Expanded(child: SizedBox()),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue