Skip to content

Commit

Permalink
Merge branch 'main' into unrated-puzzles
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudyDino committed Feb 19, 2025
2 parents 4763f0a + ddc08c2 commit 9f75ded
Show file tree
Hide file tree
Showing 14 changed files with 249 additions and 228 deletions.
4 changes: 2 additions & 2 deletions lib/src/model/user/game_history_preferences.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class GameHistoryPrefs with _$GameHistoryPrefs implements Serializable {
const GameHistoryPrefs._();

const factory GameHistoryPrefs({
@JsonKey(defaultValue: GameHistoryDisplayMode.compact)
@JsonKey(defaultValue: GameHistoryDisplayMode.detail)
required GameHistoryDisplayMode displayMode,
}) = _GameHistoryPrefs;

static const defaults = GameHistoryPrefs(displayMode: GameHistoryDisplayMode.compact);
static const defaults = GameHistoryPrefs(displayMode: GameHistoryDisplayMode.detail);

factory GameHistoryPrefs.fromJson(Map<String, dynamic> json) {
return _$GameHistoryPrefsFromJson(json);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const kSliderTheme = SliderThemeData(
primaryColor: themeLight.colorScheme.primary,
primaryContrastingColor: themeLight.colorScheme.onPrimary,
brightness: Brightness.light,
scaffoldBackgroundColor: const Color.fromARGB(255, 242, 242, 247),
scaffoldBackgroundColor: const Color.fromARGB(255, 237, 235, 233),
barBackgroundColor: const Color(0xE6F9F9F9),
textTheme: cupertinoTextTheme(themeLight.colorScheme),
);
Expand Down
5 changes: 3 additions & 2 deletions lib/src/view/account/game_bookmarks_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ class _BodyState extends ConsumerState<_Body> {
motion: const StretchMotion(),
children: [
SlidableAction(
backgroundColor: ColorScheme.of(context).surfaceContainer,
backgroundColor: ColorScheme.of(context).tertiaryContainer,
foregroundColor: ColorScheme.of(context).onTertiaryContainer,
onPressed:
game.variant.isReadSupported
? (_) {
Navigator.of(context).push(
Navigator.of(context, rootNavigator: true).push(
AnalysisScreen.buildRoute(
context,
AnalysisOptions(orientation: pov, gameId: game.id),
Expand Down
13 changes: 12 additions & 1 deletion lib/src/view/analysis/analysis_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:lichess_mobile/src/utils/navigation.dart';
import 'package:lichess_mobile/src/utils/share.dart';
import 'package:lichess_mobile/src/view/analysis/analysis_board.dart';
import 'package:lichess_mobile/src/view/analysis/analysis_layout.dart';
import 'package:lichess_mobile/src/view/analysis/analysis_settings.dart';
import 'package:lichess_mobile/src/view/analysis/analysis_settings_screen.dart';
import 'package:lichess_mobile/src/view/analysis/analysis_share_screen.dart';
import 'package:lichess_mobile/src/view/analysis/server_analysis.dart';
import 'package:lichess_mobile/src/view/analysis/tree_view.dart';
Expand Down Expand Up @@ -259,6 +259,17 @@ class _BottomBar extends ConsumerWidget {
},
icon: Icons.menu,
),
BottomBarButton(
label: context.l10n.toggleLocalEvaluation,
onTap:
analysisState.isComputerAnalysisAllowedAndEnabled
? () {
ref.read(ctrlProvider.notifier).toggleLocalEvaluation();
}
: null,
icon: CupertinoIcons.gauge,
highlighted: analysisState.isEngineAvailable,
),
RepeatButton(
onLongPress: analysisState.canGoBack ? () => _moveBackward(ref) : null,
child: BottomBarButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ class AnalysisSettingsScreen extends ConsumerWidget {
: CrossFadeState.showFirst,
firstChild: const SizedBox.shrink(),
secondChild: StockfishSettingsWidget(
onToggleLocalEvaluation: () {
ref.read(ctrlProvider.notifier).toggleLocalEvaluation();
},
onSetEngineSearchTime: (value) {
ref.read(ctrlProvider.notifier).setEngineSearchTime(value);
},
Expand Down
19 changes: 10 additions & 9 deletions lib/src/view/analysis/stockfish_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import 'package:lichess_mobile/src/widgets/settings.dart';

class StockfishSettingsWidget extends ConsumerWidget {
const StockfishSettingsWidget({
required this.onToggleLocalEvaluation,
this.onToggleLocalEvaluation,
required this.onSetEngineSearchTime,
required this.onSetNumEvalLines,
required this.onSetEngineCores,
super.key,
});

final VoidCallback onToggleLocalEvaluation;
final VoidCallback? onToggleLocalEvaluation;
final void Function(Duration) onSetEngineSearchTime;
final void Function(int) onSetNumEvalLines;
final void Function(int) onSetEngineCores;
Expand All @@ -28,13 +28,14 @@ class StockfishSettingsWidget extends ConsumerWidget {
return ListSection(
header: const SettingsSectionTitle('Stockfish 16'),
children: [
SwitchSettingTile(
title: Text(context.l10n.toggleLocalEvaluation),
value: prefs.enableLocalEvaluation,
onChanged: (_) {
onToggleLocalEvaluation();
},
),
if (onToggleLocalEvaluation != null)
SwitchSettingTile(
title: Text(context.l10n.toggleLocalEvaluation),
value: prefs.enableLocalEvaluation,
onChanged: (_) {
onToggleLocalEvaluation!.call();
},
),
PlatformListTile(
title: Text.rich(
TextSpan(
Expand Down
138 changes: 0 additions & 138 deletions lib/src/view/broadcast/broadcast_game_bottom_bar.dart

This file was deleted.

Loading

0 comments on commit 9f75ded

Please sign in to comment.