diff --git a/src/ui/flutter_app/lib/common/config.dart b/src/ui/flutter_app/lib/common/config.dart index cac2b706b..9dd042c83 100644 --- a/src/ui/flutter_app/lib/common/config.dart +++ b/src/ui/flutter_app/lib/common/config.dart @@ -48,6 +48,7 @@ class Config { static bool standardNotationEnabled = true; static bool isPieceCountInHandShown = false; static bool isNotationsShown = false; + static bool isHistoryNavigationToolbarShown = false; static double boardBorderLineWidth = 2.0; static double boardInnerLineWidth = 2.0; static double pieceWidth = 0.9; @@ -109,6 +110,8 @@ class Config { Config.isPieceCountInHandShown = settings['IsPieceCountInHandShown'] ?? false; Config.isNotationsShown = settings['IsNotationsShown'] ?? false; + Config.isHistoryNavigationToolbarShown = + settings['IsHistoryNavigationToolbarShown'] ?? false; Config.boardBorderLineWidth = settings['BoardBorderLineWidth'] ?? 2; Config.boardInnerLineWidth = settings['BoardInnerLineWidth'] ?? 2; Config.pieceWidth = settings['PieceWidth'] ?? 0.9; @@ -186,6 +189,8 @@ class Config { settings['StandardNotationEnabled'] = Config.standardNotationEnabled; settings['IsPieceCountInHandShown'] = Config.isPieceCountInHandShown; settings['IsNotationsShown'] = Config.isNotationsShown; + settings['IsHistoryNavigationToolbarShown'] = + Config.isHistoryNavigationToolbarShown; settings['BoardBorderLineWidth'] = Config.boardBorderLineWidth; settings['BoardInnerLineWidth'] = Config.boardInnerLineWidth; settings['PieceWidth'] = Config.pieceWidth; diff --git a/src/ui/flutter_app/lib/l10n/intl_de.arb b/src/ui/flutter_app/lib/l10n/intl_de.arb index 5448cdc11..f6424f5a2 100644 --- a/src/ui/flutter_app/lib/l10n/intl_de.arb +++ b/src/ui/flutter_app/lib/l10n/intl_de.arb @@ -644,6 +644,10 @@ "@isNotationsShown": { "description": "Show notations on board" }, + "isHistoryNavigationToolbarShown": "Symbolleiste für die Verlaufsnavigation anzeigen", + "@isHistoryNavigationToolbarShown": { + "description": "Show history navigation toolbar" + }, "display": "Darstellung", "@display": { "description": "Display" diff --git a/src/ui/flutter_app/lib/l10n/intl_en.arb b/src/ui/flutter_app/lib/l10n/intl_en.arb index 0d112af52..76289495b 100644 --- a/src/ui/flutter_app/lib/l10n/intl_en.arb +++ b/src/ui/flutter_app/lib/l10n/intl_en.arb @@ -644,6 +644,10 @@ "@isNotationsShown": { "description": "Show notations on board" }, + "isHistoryNavigationToolbarShown": "Show history navigation toolbar", + "@isHistoryNavigationToolbarShown": { + "description": "Show history navigation toolbar" + }, "display": "Display", "@display": { "description": "Display" diff --git a/src/ui/flutter_app/lib/l10n/intl_fa.arb b/src/ui/flutter_app/lib/l10n/intl_fa.arb index 1905a155c..96651bfa1 100644 --- a/src/ui/flutter_app/lib/l10n/intl_fa.arb +++ b/src/ui/flutter_app/lib/l10n/intl_fa.arb @@ -644,6 +644,10 @@ "@isNotationsShown": { "description": "Show notations on board" }, + "isHistoryNavigationToolbarShown": "نمایش نوار ابزار پیمایش تاریخچه", + "@isHistoryNavigationToolbarShown": { + "description": "Show history navigation toolbar" + }, "display": "نمایش دادن", "@display": { "description": "Display" diff --git a/src/ui/flutter_app/lib/l10n/intl_zh.arb b/src/ui/flutter_app/lib/l10n/intl_zh.arb index 6a568ea42..ebe5d3107 100644 --- a/src/ui/flutter_app/lib/l10n/intl_zh.arb +++ b/src/ui/flutter_app/lib/l10n/intl_zh.arb @@ -161,6 +161,7 @@ "aiIsLazy": "机器领先时懒惰", "isPieceCountInHandShown": "显示手中剩余棋子数", "isNotationsShown": "棋盘边缘显示坐标", + "isHistoryNavigationToolbarShown": "显示着法导航工具栏", "display": "显示", "boardBorderLineWidth": "棋盘外框线宽", "boardInnerLineWidth": "棋盘内部线宽", diff --git a/src/ui/flutter_app/lib/widgets/game_page.dart b/src/ui/flutter_app/lib/widgets/game_page.dart index 1ab18d939..8edff90bd 100644 --- a/src/ui/flutter_app/lib/widgets/game_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_page.dart @@ -291,7 +291,8 @@ class _GamePageState extends State if (position.phase == Phase.moving && rule.mayFly && (Game.instance.position.pieceOnBoardCount[us] == - Config.flyPieceCount || Game.instance.position.pieceOnBoardCount[us] == 3)) { + Config.flyPieceCount || + Game.instance.position.pieceOnBoardCount[us] == 3)) { print("[tap] May fly."); if (mounted) { showTip(S.of(context).tipCanMoveToAnyPoint); @@ -1415,6 +1416,80 @@ class _GamePageState extends State ); } + Widget createHistoryNavigationToolbar() { + var takeBackAllButton = TextButton( + child: Column( + // Replace with a Row for horizontal icon + text + children: [ + Icon( + Icons.first_page, + color: AppTheme.toolbarIconColor, + ), + ], + ), + onPressed: () => onTakeBackAllButtonPressed(pop: false), + ); + + var takeBackButton = TextButton( + child: Column( + // Replace with a Row for horizontal icon + text + children: [ + Icon( + ltr ? Icons.keyboard_arrow_left : Icons.keyboard_arrow_right, + color: AppTheme.toolbarIconColor, + ), + ], + ), + onPressed: () => onTakeBackButtonPressed(pop: false), + ); + + var stepForwardButton = TextButton( + child: Column( + // Replace with a Row for horizontal icon + text + children: [ + Icon( + ltr ? Icons.keyboard_arrow_right : Icons.keyboard_arrow_left, + color: AppTheme.toolbarIconColor, + ), + ], + ), + onPressed: () => onStepForwardButtonPressed(pop: false), + ); + + var stepForwardAllButton = TextButton( + child: Column( + // Replace with a Row for horizontal icon + text + children: [ + Icon( + Icons.last_page, + color: AppTheme.toolbarIconColor, + ), + ], + ), + onPressed: () => onStepForwardAllButtonPressed(pop: false), + ); + + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Color(Config.boardBackgroundColor), + ), + margin: EdgeInsets.symmetric(horizontal: GamePage.screenPaddingH), + padding: EdgeInsets.symmetric(vertical: 2), + child: Row(children: [ + Expanded(child: SizedBox()), + takeBackAllButton, + Expanded(child: SizedBox()), + takeBackButton, + Expanded(child: SizedBox()), + stepForwardButton, + Expanded(child: SizedBox()), //dashboard_outlined + stepForwardAllButton, + Expanded(child: SizedBox()), + ]), + ); + } + @override void didChangeDependencies() { super.didChangeDependencies(); @@ -1442,10 +1517,19 @@ class _GamePageState extends State final header = createPageHeader(); final board = createBoard(); final toolbar = createToolbar(); + final historyNavToolbar = createHistoryNavigationToolbar(); return Scaffold( backgroundColor: Color(Config.darkBackgroundColor), - body: Column(children: [header, board, toolbar]), + body: Column(children: [ + header, + board, + Config.isHistoryNavigationToolbarShown + ? historyNavToolbar + : SizedBox(height: 0), + SizedBox(height: 1), + toolbar, + ]), /* body: Column(children: [ header, diff --git a/src/ui/flutter_app/lib/widgets/game_settings_page.dart b/src/ui/flutter_app/lib/widgets/game_settings_page.dart index 6ecc8fbea..3c6c681cf 100644 --- a/src/ui/flutter_app/lib/widgets/game_settings_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_settings_page.dart @@ -511,6 +511,16 @@ class _GameSettingsPageState extends State { Config.save(); } + setIsHistoryNavigationToolbarShown(bool value) async { + setState(() { + Config.isHistoryNavigationToolbarShown = value; + }); + + print("[config] isHistoryNavigationToolbarShown: $value"); + + Config.save(); + } + setStandardNotationEnabled(bool value) async { setState(() { Config.standardNotationEnabled = value; diff --git a/src/ui/flutter_app/lib/widgets/personalization_settings_page.dart b/src/ui/flutter_app/lib/widgets/personalization_settings_page.dart index a0678b77d..1dd39c133 100644 --- a/src/ui/flutter_app/lib/widgets/personalization_settings_page.dart +++ b/src/ui/flutter_app/lib/widgets/personalization_settings_page.dart @@ -351,6 +351,13 @@ class _PersonalizationSettingsPageState titleString: S.of(context).isNotationsShown, ), ListItemDivider(), + SettingsSwitchListTile( + context: context, + value: Config.isHistoryNavigationToolbarShown, + onChanged: setIsHistoryNavigationToolbarShown, + titleString: S.of(context).isHistoryNavigationToolbarShown, + ), + ListItemDivider(), SettingsListTile( context: context, titleString: S.of(context).boardBorderLineWidth, @@ -463,6 +470,14 @@ class _PersonalizationSettingsPageState Config.save(); } + setIsHistoryNavigationToolbarShown(bool value) async { + setState(() { + Config.isHistoryNavigationToolbarShown = value; + }); + + Config.save(); + } + setStandardNotationEnabled(bool value) async { setState(() { Config.standardNotationEnabled = value;