From fa2a363fb3270bc8c1208202a7b0c937366bc107 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Wed, 5 Feb 2025 00:36:14 +0800 Subject: [PATCH] Use moves list page instead of dialog if screenReaderSupport is off Change-Id: I3917f3150ab8766344f3405e5e0bdb9ede302036 --- .../widgets/dialogs/move_list_dialog.dart | 19 ------------------- .../widgets/modals/move_options_modal.dart | 14 +++++++++++++- .../game_page/widgets/moves_list_page.dart | 2 +- .../lib/game_page/widgets/play_area.dart | 14 +++++++++++++- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/ui/flutter_app/lib/game_page/widgets/dialogs/move_list_dialog.dart b/src/ui/flutter_app/lib/game_page/widgets/dialogs/move_list_dialog.dart index 438a16925..893c7a2f1 100644 --- a/src/ui/flutter_app/lib/game_page/widgets/dialogs/move_list_dialog.dart +++ b/src/ui/flutter_app/lib/game_page/widgets/dialogs/move_list_dialog.dart @@ -132,25 +132,6 @@ class MoveListDialog extends StatelessWidget { }, ), ), - // Branch Graph – when pressed, navigates to BranchGraphPage. - Expanded( - child: TextButton( - key: const Key('move_list_dialog_branch_graph_button'), - child: Text( - S.of(context).more, - style: _getButtonTextStyle(context), - ), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - const MovesListPage(), - ), - ); - }, - ), - ), Expanded( child: TextButton( key: const Key('move_list_dialog_cancel_button'), diff --git a/src/ui/flutter_app/lib/game_page/widgets/modals/move_options_modal.dart b/src/ui/flutter_app/lib/game_page/widgets/modals/move_options_modal.dart index c3595ac86..f76605264 100644 --- a/src/ui/flutter_app/lib/game_page/widgets/modals/move_options_modal.dart +++ b/src/ui/flutter_app/lib/game_page/widgets/modals/move_options_modal.dart @@ -70,7 +70,19 @@ class MoveOptionsModal extends StatelessWidget { GameController().isPositionSetup == true) ...[ SimpleDialogOption( key: const Key('show_move_list_option'), - onPressed: () => _showMoveList(context), + onPressed: () { + if (DB().generalSettings.screenReaderSupport) { + _showMoveList(context); + } else { + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const MovesListPage(), + ), + ); + } + }, child: Padding( padding: const EdgeInsets.symmetric(vertical: 2.0), child: Text(S.of(context).showMoveList), diff --git a/src/ui/flutter_app/lib/game_page/widgets/moves_list_page.dart b/src/ui/flutter_app/lib/game_page/widgets/moves_list_page.dart index 3443c2a7a..83a67870e 100644 --- a/src/ui/flutter_app/lib/game_page/widgets/moves_list_page.dart +++ b/src/ui/flutter_app/lib/game_page/widgets/moves_list_page.dart @@ -22,7 +22,7 @@ enum MovesViewLayout { details, } -/// BranchGraphPage now displays PGN nodes in potentially different layouts. +/// MovesListPage now displays PGN nodes in potentially different layouts. /// The user can pick from a set of layout options via a single active icon which, /// when tapped, reveals a horizontal row of layout icons. class MovesListPage extends StatefulWidget { diff --git a/src/ui/flutter_app/lib/game_page/widgets/play_area.dart b/src/ui/flutter_app/lib/game_page/widgets/play_area.dart index df9e2f2e3..859af2dee 100644 --- a/src/ui/flutter_app/lib/game_page/widgets/play_area.dart +++ b/src/ui/flutter_app/lib/game_page/widgets/play_area.dart @@ -17,6 +17,7 @@ import '../services/mill.dart'; import '../services/painters/advantage_graph_painter.dart'; import 'game_page.dart'; import 'modals/game_options_modal.dart'; +import 'moves_list_page.dart'; import 'toolbars/game_toolbar.dart'; /// The PlayArea widget is the main content of the game page. @@ -147,7 +148,18 @@ class PlayAreaState extends State { ), ToolbarItem.icon( key: const Key('play_area_toolbar_item_move'), - onPressed: () => _openModal(context, _buildMoveModal(context)), + onPressed: () { + if (DB().generalSettings.screenReaderSupport) { + _openModal(context, _buildMoveModal(context)); + } else { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const MovesListPage(), + ), + ); + } + }, icon: const Icon(FluentIcons.calendar_agenda_24_regular), label: Text(S.of(context).move, key: const Key('play_area_toolbar_item_move_label'),