Skip to content

Commit

Permalink
Disallow editor when engine is not allowed
Browse files Browse the repository at this point in the history
Fixes #1350
  • Loading branch information
veloce committed Jan 10, 2025
1 parent 366e6a0 commit efa355f
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/src/view/analysis/analysis_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,23 @@ class _BottomBar extends ConsumerWidget {
ref.read(analysisControllerProvider(options).notifier).userPrevious();

Future<void> _showAnalysisMenu(BuildContext context, WidgetRef ref) {
final analysisState = ref.read(analysisControllerProvider(options)).requireValue;
return showAdaptiveActionSheet(
context: context,
actions: [
BottomSheetAction(
makeLabel: (context) => Text(context.l10n.boardEditor),
onPressed: (context) {
final analysisState = ref.read(analysisControllerProvider(options)).requireValue;
final boardFen = analysisState.position.fen;
pushPlatformRoute(
context,
title: context.l10n.boardEditor,
builder: (_) => BoardEditorScreen(initialFen: boardFen),
);
},
),
// board editor can be used to quickly analyze a position, so engine must be allowed to access
if (analysisState.isComputerAnalysisAllowed)
BottomSheetAction(
makeLabel: (context) => Text(context.l10n.boardEditor),
onPressed: (context) {
final boardFen = analysisState.position.fen;
pushPlatformRoute(
context,
title: context.l10n.boardEditor,
builder: (_) => BoardEditorScreen(initialFen: boardFen),
);
},
),
BottomSheetAction(
makeLabel: (context) => Text(context.l10n.mobileShareGamePGN),
onPressed: (_) {
Expand Down

0 comments on commit efa355f

Please sign in to comment.