Skip to content

Commit

Permalink
Add piece animation settings in puzzle screen
Browse files Browse the repository at this point in the history
Closes #630
  • Loading branch information
veloce committed Apr 15, 2024
1 parent 70a647f commit 85b1651
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/src/view/puzzle/puzzle_settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lichess_mobile/src/model/common/id.dart';
import 'package:lichess_mobile/src/model/puzzle/puzzle_preferences.dart';
import 'package:lichess_mobile/src/model/settings/board_preferences.dart';
import 'package:lichess_mobile/src/utils/l10n_context.dart';
import 'package:lichess_mobile/src/widgets/list.dart';
import 'package:lichess_mobile/src/widgets/platform.dart';
Expand Down Expand Up @@ -48,6 +49,7 @@ class _Body extends ConsumerWidget {
final autoNext = ref.watch(
PuzzlePreferencesProvider(userId).select((value) => value.autoNext),
);
final boardPrefs = ref.watch(boardPreferencesProvider);

return SafeArea(
child: ListView(
Expand All @@ -61,10 +63,21 @@ class _Body extends ConsumerWidget {
value: autoNext,
onChanged: (value) {
ref
.read(PuzzlePreferencesProvider(userId).notifier)
.read(puzzlePreferencesProvider(userId).notifier)
.setAutoNext(value);
},
),
SwitchSettingTile(
title: Text(
context.l10n.preferencesPieceAnimation,
),
value: boardPrefs.pieceAnimation,
onChanged: (value) {
ref
.read(boardPreferencesProvider.notifier)
.togglePieceAnimation();
},
),
],
),
],
Expand Down

0 comments on commit 85b1651

Please sign in to comment.