flutter: Support exporting game

This commit is contained in:
Calcitem 2021-06-09 01:00:21 +08:00
parent 6d8af3cfcf
commit 61e3da9034
5 changed files with 33 additions and 1 deletions

View File

@ -212,6 +212,10 @@
"@importGame": { "@importGame": {
"description": "Import game" "description": "Import game"
}, },
"exportGame": "Spiel exportieren",
"@exportGame": {
"description": "Export game"
},
"gameImported": "Spiel aus der Zwischenablage importiert.", "gameImported": "Spiel aus der Zwischenablage importiert.",
"@gameImported": { "@gameImported": {
"description": "Game imported from clipboard." "description": "Game imported from clipboard."

View File

@ -212,6 +212,10 @@
"@importGame": { "@importGame": {
"description": "Import game" "description": "Import game"
}, },
"exportGame": "Export game",
"@exportGame": {
"description": "Export game"
},
"gameImported": "Game imported from clipboard.", "gameImported": "Game imported from clipboard.",
"@gameImported": { "@gameImported": {
"description": "Game imported from clipboard." "description": "Game imported from clipboard."

View File

@ -212,6 +212,10 @@
"@importGame": { "@importGame": {
"description": "Import game" "description": "Import game"
}, },
"exportGame": "صادرات بازی",
"@exportGame": {
"description": "Export game"
},
"gameImported": "بازی از کلیپ بورد وارد شده است.", "gameImported": "بازی از کلیپ بورد وارد شده است.",
"@gameImported": { "@gameImported": {
"description": "Game imported from clipboard." "description": "Game imported from clipboard."

View File

@ -52,7 +52,8 @@
"thinking": "对方思考中...", "thinking": "对方思考中...",
"newGame": "开始新局", "newGame": "开始新局",
"startNewGame": "开始新局", "startNewGame": "开始新局",
"importGame": "导入棋谱", "importGame": "导入棋局",
"exportGame": "导出棋局",
"gameImported": "棋谱已从剪贴板导入", "gameImported": "棋谱已从剪贴板导入",
"startRecording": "开始录制", "startRecording": "开始录制",
"recording": "录制中...", "recording": "录制中...",

View File

@ -571,6 +571,16 @@ class _GamePageState extends State<GamePage>
showTip(S.of(context).gameImported); showTip(S.of(context).gameImported);
} }
onExportGameButtonPressed() async {
Navigator.of(context).pop();
final moveHistoryText = Game.instance.position.moveHistoryText;
Clipboard.setData(ClipboardData(text: moveHistoryText)).then((_) {
showSnackBar(S.of(context).moveHistoryCopied);
});
}
/* /*
onStartRecordingButtonPressed() async { onStartRecordingButtonPressed() async {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -686,6 +696,15 @@ class _GamePageState extends State<GamePage>
), ),
onPressed: onImportGameButtonPressed, onPressed: onImportGameButtonPressed,
), ),
SizedBox(height: AppTheme.sizedBoxHeight),
SimpleDialogOption(
child: Text(
S.of(context).exportGame,
style: AppTheme.simpleDialogOptionTextStyle,
textAlign: TextAlign.center,
),
onPressed: onExportGameButtonPressed,
),
/* /*
SizedBox(height: AppTheme.sizedBoxHeight), SizedBox(height: AppTheme.sizedBoxHeight),
Config.experimentsEnabled Config.experimentsEnabled