Update theme settings in app_settings_provider.dart

This commit is contained in:
Dr-Blank 2024-08-20 11:39:26 -04:00
parent 8d71020436
commit 74e0d77cf9
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
10 changed files with 239 additions and 65 deletions

View file

@ -223,7 +223,7 @@ class _HeroSectionSubLabelWithIcon extends HookConsumerWidget {
final useFontAwesome = final useFontAwesome =
icon.runtimeType == FontAwesomeIcons.book.runtimeType; icon.runtimeType == FontAwesomeIcons.book.runtimeType;
final useMaterialThemeOnItemPage = final useMaterialThemeOnItemPage =
ref.watch(appSettingsProvider).useMaterialThemeOnItemPage; ref.watch(appSettingsProvider).themeSettings.useMaterialThemeOnItemPage;
final color = useMaterialThemeOnItemPage final color = useMaterialThemeOnItemPage
? themeData.colorScheme.primary ? themeData.colorScheme.primary
: themeData.colorScheme.onSurface.withOpacity(0.75); : themeData.colorScheme.onSurface.withOpacity(0.75);
@ -356,7 +356,7 @@ class _BookCover extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final themeData = Theme.of(context); final themeData = Theme.of(context);
final useMaterialThemeOnItemPage = final useMaterialThemeOnItemPage =
ref.watch(appSettingsProvider).useMaterialThemeOnItemPage; ref.watch(appSettingsProvider).themeSettings.useMaterialThemeOnItemPage;
return ThemeSwitcher( return ThemeSwitcher(
builder: (context) { builder: (context) {

View file

@ -41,7 +41,7 @@ class LibraryItemPage extends HookConsumerWidget {
itemFromApi.valueOrNull?.media.metadata.asBookMetadataExpanded; itemFromApi.valueOrNull?.media.metadata.asBookMetadataExpanded;
final useMaterialThemeOnItemPage = final useMaterialThemeOnItemPage =
ref.watch(appSettingsProvider).useMaterialThemeOnItemPage; ref.watch(appSettingsProvider).themeSettings.useMaterialThemeOnItemPage;
AsyncValue<ColorScheme?> coverColorScheme = const AsyncValue.loading(); AsyncValue<ColorScheme?> coverColorScheme = const AsyncValue.loading();
if (useMaterialThemeOnItemPage) { if (useMaterialThemeOnItemPage) {
coverColorScheme = ref.watch( coverColorScheme = ref.watch(

View file

@ -81,7 +81,7 @@ class MyApp extends ConsumerWidget {
// debugShowCheckedModeBanner: false, // debugShowCheckedModeBanner: false,
theme: lightTheme, theme: lightTheme,
darkTheme: darkTheme, darkTheme: darkTheme,
themeMode: ref.watch(appSettingsProvider).isDarkMode themeMode: ref.watch(appSettingsProvider).themeSettings.isDarkMode
? ThemeMode.dark ? ThemeMode.dark
: ThemeMode.light, : ThemeMode.light,
routerConfig: routerConfig, routerConfig: routerConfig,

View file

@ -44,7 +44,8 @@ class AppSettings extends _$AppSettings {
} }
void toggleDarkMode() { void toggleDarkMode() {
state = state.copyWith(isDarkMode: !state.isDarkMode); state = state.copyWith
.themeSettings(isDarkMode: !state.themeSettings.isDarkMode);
} }
void updateState(model.AppSettings newSettings) { void updateState(model.AppSettings newSettings) {

View file

@ -6,7 +6,7 @@ part of 'app_settings_provider.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$appSettingsHash() => r'99bd35aff3c02252a4013c674fd885e841a7f703'; String _$appSettingsHash() => r'ab8fa4602242704a71b34dc2bb5dcb0c91092797';
/// See also [AppSettings]. /// See also [AppSettings].
@ProviderFor(AppSettings) @ProviderFor(AppSettings)

View file

@ -11,8 +11,7 @@ part 'app_settings.g.dart';
@freezed @freezed
class AppSettings with _$AppSettings { class AppSettings with _$AppSettings {
const factory AppSettings({ const factory AppSettings({
@Default(true) bool isDarkMode, @Default(ThemeSettings()) ThemeSettings themeSettings,
@Default(true) bool useMaterialThemeOnItemPage,
@Default(PlayerSettings()) PlayerSettings playerSettings, @Default(PlayerSettings()) PlayerSettings playerSettings,
@Default(DownloadSettings()) DownloadSettings downloadSettings, @Default(DownloadSettings()) DownloadSettings downloadSettings,
}) = _AppSettings; }) = _AppSettings;
@ -21,6 +20,17 @@ class AppSettings with _$AppSettings {
_$AppSettingsFromJson(json); _$AppSettingsFromJson(json);
} }
@freezed
class ThemeSettings with _$ThemeSettings {
const factory ThemeSettings({
@Default(true) bool isDarkMode,
@Default(true) bool useMaterialThemeOnItemPage,
}) = _ThemeSettings;
factory ThemeSettings.fromJson(Map<String, dynamic> json) =>
_$ThemeSettingsFromJson(json);
}
@freezed @freezed
class PlayerSettings with _$PlayerSettings { class PlayerSettings with _$PlayerSettings {
const factory PlayerSettings({ const factory PlayerSettings({

View file

@ -20,8 +20,7 @@ AppSettings _$AppSettingsFromJson(Map<String, dynamic> json) {
/// @nodoc /// @nodoc
mixin _$AppSettings { mixin _$AppSettings {
bool get isDarkMode => throw _privateConstructorUsedError; ThemeSettings get themeSettings => throw _privateConstructorUsedError;
bool get useMaterialThemeOnItemPage => throw _privateConstructorUsedError;
PlayerSettings get playerSettings => throw _privateConstructorUsedError; PlayerSettings get playerSettings => throw _privateConstructorUsedError;
DownloadSettings get downloadSettings => throw _privateConstructorUsedError; DownloadSettings get downloadSettings => throw _privateConstructorUsedError;
@ -38,11 +37,11 @@ abstract class $AppSettingsCopyWith<$Res> {
_$AppSettingsCopyWithImpl<$Res, AppSettings>; _$AppSettingsCopyWithImpl<$Res, AppSettings>;
@useResult @useResult
$Res call( $Res call(
{bool isDarkMode, {ThemeSettings themeSettings,
bool useMaterialThemeOnItemPage,
PlayerSettings playerSettings, PlayerSettings playerSettings,
DownloadSettings downloadSettings}); DownloadSettings downloadSettings});
$ThemeSettingsCopyWith<$Res> get themeSettings;
$PlayerSettingsCopyWith<$Res> get playerSettings; $PlayerSettingsCopyWith<$Res> get playerSettings;
$DownloadSettingsCopyWith<$Res> get downloadSettings; $DownloadSettingsCopyWith<$Res> get downloadSettings;
} }
@ -60,20 +59,15 @@ class _$AppSettingsCopyWithImpl<$Res, $Val extends AppSettings>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? isDarkMode = null, Object? themeSettings = null,
Object? useMaterialThemeOnItemPage = null,
Object? playerSettings = null, Object? playerSettings = null,
Object? downloadSettings = null, Object? downloadSettings = null,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
isDarkMode: null == isDarkMode themeSettings: null == themeSettings
? _value.isDarkMode ? _value.themeSettings
: isDarkMode // ignore: cast_nullable_to_non_nullable : themeSettings // ignore: cast_nullable_to_non_nullable
as bool, as ThemeSettings,
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
? _value.useMaterialThemeOnItemPage
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
as bool,
playerSettings: null == playerSettings playerSettings: null == playerSettings
? _value.playerSettings ? _value.playerSettings
: playerSettings // ignore: cast_nullable_to_non_nullable : playerSettings // ignore: cast_nullable_to_non_nullable
@ -85,6 +79,14 @@ class _$AppSettingsCopyWithImpl<$Res, $Val extends AppSettings>
) as $Val); ) as $Val);
} }
@override
@pragma('vm:prefer-inline')
$ThemeSettingsCopyWith<$Res> get themeSettings {
return $ThemeSettingsCopyWith<$Res>(_value.themeSettings, (value) {
return _then(_value.copyWith(themeSettings: value) as $Val);
});
}
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$PlayerSettingsCopyWith<$Res> get playerSettings { $PlayerSettingsCopyWith<$Res> get playerSettings {
@ -111,11 +113,12 @@ abstract class _$$AppSettingsImplCopyWith<$Res>
@override @override
@useResult @useResult
$Res call( $Res call(
{bool isDarkMode, {ThemeSettings themeSettings,
bool useMaterialThemeOnItemPage,
PlayerSettings playerSettings, PlayerSettings playerSettings,
DownloadSettings downloadSettings}); DownloadSettings downloadSettings});
@override
$ThemeSettingsCopyWith<$Res> get themeSettings;
@override @override
$PlayerSettingsCopyWith<$Res> get playerSettings; $PlayerSettingsCopyWith<$Res> get playerSettings;
@override @override
@ -133,20 +136,15 @@ class __$$AppSettingsImplCopyWithImpl<$Res>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? isDarkMode = null, Object? themeSettings = null,
Object? useMaterialThemeOnItemPage = null,
Object? playerSettings = null, Object? playerSettings = null,
Object? downloadSettings = null, Object? downloadSettings = null,
}) { }) {
return _then(_$AppSettingsImpl( return _then(_$AppSettingsImpl(
isDarkMode: null == isDarkMode themeSettings: null == themeSettings
? _value.isDarkMode ? _value.themeSettings
: isDarkMode // ignore: cast_nullable_to_non_nullable : themeSettings // ignore: cast_nullable_to_non_nullable
as bool, as ThemeSettings,
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
? _value.useMaterialThemeOnItemPage
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
as bool,
playerSettings: null == playerSettings playerSettings: null == playerSettings
? _value.playerSettings ? _value.playerSettings
: playerSettings // ignore: cast_nullable_to_non_nullable : playerSettings // ignore: cast_nullable_to_non_nullable
@ -163,8 +161,7 @@ class __$$AppSettingsImplCopyWithImpl<$Res>
@JsonSerializable() @JsonSerializable()
class _$AppSettingsImpl implements _AppSettings { class _$AppSettingsImpl implements _AppSettings {
const _$AppSettingsImpl( const _$AppSettingsImpl(
{this.isDarkMode = true, {this.themeSettings = const ThemeSettings(),
this.useMaterialThemeOnItemPage = true,
this.playerSettings = const PlayerSettings(), this.playerSettings = const PlayerSettings(),
this.downloadSettings = const DownloadSettings()}); this.downloadSettings = const DownloadSettings()});
@ -173,10 +170,7 @@ class _$AppSettingsImpl implements _AppSettings {
@override @override
@JsonKey() @JsonKey()
final bool isDarkMode; final ThemeSettings themeSettings;
@override
@JsonKey()
final bool useMaterialThemeOnItemPage;
@override @override
@JsonKey() @JsonKey()
final PlayerSettings playerSettings; final PlayerSettings playerSettings;
@ -186,7 +180,7 @@ class _$AppSettingsImpl implements _AppSettings {
@override @override
String toString() { String toString() {
return 'AppSettings(isDarkMode: $isDarkMode, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, playerSettings: $playerSettings, downloadSettings: $downloadSettings)'; return 'AppSettings(themeSettings: $themeSettings, playerSettings: $playerSettings, downloadSettings: $downloadSettings)';
} }
@override @override
@ -194,12 +188,8 @@ class _$AppSettingsImpl implements _AppSettings {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$AppSettingsImpl && other is _$AppSettingsImpl &&
(identical(other.isDarkMode, isDarkMode) || (identical(other.themeSettings, themeSettings) ||
other.isDarkMode == isDarkMode) && other.themeSettings == themeSettings) &&
(identical(other.useMaterialThemeOnItemPage,
useMaterialThemeOnItemPage) ||
other.useMaterialThemeOnItemPage ==
useMaterialThemeOnItemPage) &&
(identical(other.playerSettings, playerSettings) || (identical(other.playerSettings, playerSettings) ||
other.playerSettings == playerSettings) && other.playerSettings == playerSettings) &&
(identical(other.downloadSettings, downloadSettings) || (identical(other.downloadSettings, downloadSettings) ||
@ -208,8 +198,8 @@ class _$AppSettingsImpl implements _AppSettings {
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => Object.hash(runtimeType, isDarkMode, int get hashCode =>
useMaterialThemeOnItemPage, playerSettings, downloadSettings); Object.hash(runtimeType, themeSettings, playerSettings, downloadSettings);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -227,8 +217,7 @@ class _$AppSettingsImpl implements _AppSettings {
abstract class _AppSettings implements AppSettings { abstract class _AppSettings implements AppSettings {
const factory _AppSettings( const factory _AppSettings(
{final bool isDarkMode, {final ThemeSettings themeSettings,
final bool useMaterialThemeOnItemPage,
final PlayerSettings playerSettings, final PlayerSettings playerSettings,
final DownloadSettings downloadSettings}) = _$AppSettingsImpl; final DownloadSettings downloadSettings}) = _$AppSettingsImpl;
@ -236,9 +225,7 @@ abstract class _AppSettings implements AppSettings {
_$AppSettingsImpl.fromJson; _$AppSettingsImpl.fromJson;
@override @override
bool get isDarkMode; ThemeSettings get themeSettings;
@override
bool get useMaterialThemeOnItemPage;
@override @override
PlayerSettings get playerSettings; PlayerSettings get playerSettings;
@override @override
@ -249,6 +236,168 @@ abstract class _AppSettings implements AppSettings {
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
} }
ThemeSettings _$ThemeSettingsFromJson(Map<String, dynamic> json) {
return _ThemeSettings.fromJson(json);
}
/// @nodoc
mixin _$ThemeSettings {
bool get isDarkMode => throw _privateConstructorUsedError;
bool get useMaterialThemeOnItemPage => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ThemeSettingsCopyWith<ThemeSettings> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ThemeSettingsCopyWith<$Res> {
factory $ThemeSettingsCopyWith(
ThemeSettings value, $Res Function(ThemeSettings) then) =
_$ThemeSettingsCopyWithImpl<$Res, ThemeSettings>;
@useResult
$Res call({bool isDarkMode, bool useMaterialThemeOnItemPage});
}
/// @nodoc
class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
implements $ThemeSettingsCopyWith<$Res> {
_$ThemeSettingsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? isDarkMode = null,
Object? useMaterialThemeOnItemPage = null,
}) {
return _then(_value.copyWith(
isDarkMode: null == isDarkMode
? _value.isDarkMode
: isDarkMode // ignore: cast_nullable_to_non_nullable
as bool,
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
? _value.useMaterialThemeOnItemPage
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$ThemeSettingsImplCopyWith<$Res>
implements $ThemeSettingsCopyWith<$Res> {
factory _$$ThemeSettingsImplCopyWith(
_$ThemeSettingsImpl value, $Res Function(_$ThemeSettingsImpl) then) =
__$$ThemeSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool isDarkMode, bool useMaterialThemeOnItemPage});
}
/// @nodoc
class __$$ThemeSettingsImplCopyWithImpl<$Res>
extends _$ThemeSettingsCopyWithImpl<$Res, _$ThemeSettingsImpl>
implements _$$ThemeSettingsImplCopyWith<$Res> {
__$$ThemeSettingsImplCopyWithImpl(
_$ThemeSettingsImpl _value, $Res Function(_$ThemeSettingsImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? isDarkMode = null,
Object? useMaterialThemeOnItemPage = null,
}) {
return _then(_$ThemeSettingsImpl(
isDarkMode: null == isDarkMode
? _value.isDarkMode
: isDarkMode // ignore: cast_nullable_to_non_nullable
as bool,
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
? _value.useMaterialThemeOnItemPage
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ThemeSettingsImpl implements _ThemeSettings {
const _$ThemeSettingsImpl(
{this.isDarkMode = true, this.useMaterialThemeOnItemPage = true});
factory _$ThemeSettingsImpl.fromJson(Map<String, dynamic> json) =>
_$$ThemeSettingsImplFromJson(json);
@override
@JsonKey()
final bool isDarkMode;
@override
@JsonKey()
final bool useMaterialThemeOnItemPage;
@override
String toString() {
return 'ThemeSettings(isDarkMode: $isDarkMode, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ThemeSettingsImpl &&
(identical(other.isDarkMode, isDarkMode) ||
other.isDarkMode == isDarkMode) &&
(identical(other.useMaterialThemeOnItemPage,
useMaterialThemeOnItemPage) ||
other.useMaterialThemeOnItemPage ==
useMaterialThemeOnItemPage));
}
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, isDarkMode, useMaterialThemeOnItemPage);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ThemeSettingsImplCopyWith<_$ThemeSettingsImpl> get copyWith =>
__$$ThemeSettingsImplCopyWithImpl<_$ThemeSettingsImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ThemeSettingsImplToJson(
this,
);
}
}
abstract class _ThemeSettings implements ThemeSettings {
const factory _ThemeSettings(
{final bool isDarkMode,
final bool useMaterialThemeOnItemPage}) = _$ThemeSettingsImpl;
factory _ThemeSettings.fromJson(Map<String, dynamic> json) =
_$ThemeSettingsImpl.fromJson;
@override
bool get isDarkMode;
@override
bool get useMaterialThemeOnItemPage;
@override
@JsonKey(ignore: true)
_$$ThemeSettingsImplCopyWith<_$ThemeSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
PlayerSettings _$PlayerSettingsFromJson(Map<String, dynamic> json) { PlayerSettings _$PlayerSettingsFromJson(Map<String, dynamic> json) {
return _PlayerSettings.fromJson(json); return _PlayerSettings.fromJson(json);
} }

View file

@ -8,9 +8,10 @@ part of 'app_settings.dart';
_$AppSettingsImpl _$$AppSettingsImplFromJson(Map<String, dynamic> json) => _$AppSettingsImpl _$$AppSettingsImplFromJson(Map<String, dynamic> json) =>
_$AppSettingsImpl( _$AppSettingsImpl(
isDarkMode: json['isDarkMode'] as bool? ?? true, themeSettings: json['themeSettings'] == null
useMaterialThemeOnItemPage: ? const ThemeSettings()
json['useMaterialThemeOnItemPage'] as bool? ?? true, : ThemeSettings.fromJson(
json['themeSettings'] as Map<String, dynamic>),
playerSettings: json['playerSettings'] == null playerSettings: json['playerSettings'] == null
? const PlayerSettings() ? const PlayerSettings()
: PlayerSettings.fromJson( : PlayerSettings.fromJson(
@ -23,12 +24,24 @@ _$AppSettingsImpl _$$AppSettingsImplFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> _$$AppSettingsImplToJson(_$AppSettingsImpl instance) => Map<String, dynamic> _$$AppSettingsImplToJson(_$AppSettingsImpl instance) =>
<String, dynamic>{ <String, dynamic>{
'isDarkMode': instance.isDarkMode, 'themeSettings': instance.themeSettings,
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
'playerSettings': instance.playerSettings, 'playerSettings': instance.playerSettings,
'downloadSettings': instance.downloadSettings, 'downloadSettings': instance.downloadSettings,
}; };
_$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
_$ThemeSettingsImpl(
isDarkMode: json['isDarkMode'] as bool? ?? true,
useMaterialThemeOnItemPage:
json['useMaterialThemeOnItemPage'] as bool? ?? true,
);
Map<String, dynamic> _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) =>
<String, dynamic>{
'isDarkMode': instance.isDarkMode,
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
};
_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) => _$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) =>
_$PlayerSettingsImpl( _$PlayerSettingsImpl(
miniPlayerSettings: json['miniPlayerSettings'] == null miniPlayerSettings: json['miniPlayerSettings'] == null

View file

@ -44,10 +44,10 @@ class AppSettingsPage extends HookConsumerWidget {
), ),
tiles: [ tiles: [
SettingsTile.switchTile( SettingsTile.switchTile(
initialValue: appSettings.isDarkMode, initialValue: appSettings.themeSettings.isDarkMode,
title: const Text('Dark Mode'), title: const Text('Dark Mode'),
description: const Text('we all know dark mode is better'), description: const Text('we all know dark mode is better'),
leading: appSettings.isDarkMode leading: appSettings.themeSettings.isDarkMode
? const Icon(Icons.dark_mode) ? const Icon(Icons.dark_mode)
: const Icon(Icons.light_mode), : const Icon(Icons.light_mode),
onToggle: (value) { onToggle: (value) {
@ -55,17 +55,18 @@ class AppSettingsPage extends HookConsumerWidget {
}, },
), ),
SettingsTile.switchTile( SettingsTile.switchTile(
initialValue: appSettings.useMaterialThemeOnItemPage, initialValue:
appSettings.themeSettings.useMaterialThemeOnItemPage,
title: const Text('Adaptive Theme on Item Page'), title: const Text('Adaptive Theme on Item Page'),
description: const Text( description: const Text(
'get fancy with the colors on the item page at the cost of some performance', 'get fancy with the colors on the item page at the cost of some performance',
), ),
leading: appSettings.useMaterialThemeOnItemPage leading: appSettings.themeSettings.useMaterialThemeOnItemPage
? const Icon(Icons.auto_fix_high) ? const Icon(Icons.auto_fix_high)
: const Icon(Icons.auto_fix_off), : const Icon(Icons.auto_fix_off),
onToggle: (value) { onToggle: (value) {
ref.read(appSettingsProvider.notifier).updateState( ref.read(appSettingsProvider.notifier).updateState(
appSettings.copyWith( appSettings.copyWith.themeSettings(
useMaterialThemeOnItemPage: value, useMaterialThemeOnItemPage: value,
), ),
); );

View file

@ -224,7 +224,7 @@ class _BookOnShelfPlayButton extends HookConsumerWidget {
var strokeWidth = size / 8; var strokeWidth = size / 8;
final useMaterialThemeOnItemPage = final useMaterialThemeOnItemPage =
ref.watch(appSettingsProvider).useMaterialThemeOnItemPage; ref.watch(appSettingsProvider).themeSettings.useMaterialThemeOnItemPage;
AsyncValue<ColorScheme?> coverColorScheme = const AsyncValue.loading(); AsyncValue<ColorScheme?> coverColorScheme = const AsyncValue.loading();
if (useMaterialThemeOnItemPage && isCurrentBookSetInPlayer) { if (useMaterialThemeOnItemPage && isCurrentBookSetInPlayer) {