Skip to content

Commit

Permalink
Use moves list page instead of dialog if screenReaderSupport is off
Browse files Browse the repository at this point in the history
Change-Id: I3917f3150ab8766344f3405e5e0bdb9ede302036
  • Loading branch information
calcitem committed Feb 4, 2025
1 parent 6625b4c commit fa2a363
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<MovesListPage>(
builder: (BuildContext context) =>
const MovesListPage(),
),
);
},
),
),
Expanded(
child: TextButton(
key: const Key('move_list_dialog_cancel_button'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,19 @@ class MoveOptionsModal extends StatelessWidget {
GameController().isPositionSetup == true) ...<Widget>[
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<void>(
builder: (BuildContext context) => const MovesListPage(),
),
);
}
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
child: Text(S.of(context).showMoveList),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 13 additions & 1 deletion src/ui/flutter_app/lib/game_page/widgets/play_area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -147,7 +148,18 @@ class PlayAreaState extends State<PlayArea> {
),
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<void>(
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'),
Expand Down

0 comments on commit fa2a363

Please sign in to comment.