mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-07-06 17:31:33 +00:00
refactor: rename useMaterialThemeOfPlayingItem to useCurrentPlayerThemeThroughoutApp for clarity
This commit is contained in:
parent
9a49dc5675
commit
69f31b8dea
5 changed files with 43 additions and 39 deletions
|
|
@ -82,7 +82,7 @@ class MyApp extends ConsumerWidget {
|
|||
}
|
||||
}
|
||||
|
||||
if (themeSettings.useMaterialThemeOfPlayingItem) {
|
||||
if (themeSettings.useCurrentPlayerThemeThroughoutApp) {
|
||||
final player = ref.watch(audiobookPlayerProvider);
|
||||
if (player.book != null) {
|
||||
final themeLight = ref.watch(
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ class ThemeSettings with _$ThemeSettings {
|
|||
@Default(false) bool highContrast,
|
||||
@Default(false) bool useMaterialThemeFromSystem,
|
||||
@Default('#FF311B92') String customThemeColor,
|
||||
@Default(true) bool useMaterialThemeOfPlayingItem,
|
||||
@Default(true) bool useMaterialThemeOnItemPage,
|
||||
@Default(true) bool useCurrentPlayerThemeThroughoutApp,
|
||||
}) = _ThemeSettings;
|
||||
|
||||
factory ThemeSettings.fromJson(Map<String, dynamic> json) =>
|
||||
|
|
|
|||
|
|
@ -382,8 +382,9 @@ mixin _$ThemeSettings {
|
|||
bool get highContrast => throw _privateConstructorUsedError;
|
||||
bool get useMaterialThemeFromSystem => throw _privateConstructorUsedError;
|
||||
String get customThemeColor => throw _privateConstructorUsedError;
|
||||
bool get useMaterialThemeOfPlayingItem => throw _privateConstructorUsedError;
|
||||
bool get useMaterialThemeOnItemPage => throw _privateConstructorUsedError;
|
||||
bool get useCurrentPlayerThemeThroughoutApp =>
|
||||
throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ThemeSettings to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
|
@ -406,8 +407,8 @@ abstract class $ThemeSettingsCopyWith<$Res> {
|
|||
bool highContrast,
|
||||
bool useMaterialThemeFromSystem,
|
||||
String customThemeColor,
|
||||
bool useMaterialThemeOfPlayingItem,
|
||||
bool useMaterialThemeOnItemPage});
|
||||
bool useMaterialThemeOnItemPage,
|
||||
bool useCurrentPlayerThemeThroughoutApp});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -429,8 +430,8 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
|
|||
Object? highContrast = null,
|
||||
Object? useMaterialThemeFromSystem = null,
|
||||
Object? customThemeColor = null,
|
||||
Object? useMaterialThemeOfPlayingItem = null,
|
||||
Object? useMaterialThemeOnItemPage = null,
|
||||
Object? useCurrentPlayerThemeThroughoutApp = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
themeMode: null == themeMode
|
||||
|
|
@ -449,14 +450,15 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
|
|||
? _value.customThemeColor
|
||||
: customThemeColor // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
useMaterialThemeOfPlayingItem: null == useMaterialThemeOfPlayingItem
|
||||
? _value.useMaterialThemeOfPlayingItem
|
||||
: useMaterialThemeOfPlayingItem // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
|
||||
? _value.useMaterialThemeOnItemPage
|
||||
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
useCurrentPlayerThemeThroughoutApp: null ==
|
||||
useCurrentPlayerThemeThroughoutApp
|
||||
? _value.useCurrentPlayerThemeThroughoutApp
|
||||
: useCurrentPlayerThemeThroughoutApp // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
|
@ -474,8 +476,8 @@ abstract class _$$ThemeSettingsImplCopyWith<$Res>
|
|||
bool highContrast,
|
||||
bool useMaterialThemeFromSystem,
|
||||
String customThemeColor,
|
||||
bool useMaterialThemeOfPlayingItem,
|
||||
bool useMaterialThemeOnItemPage});
|
||||
bool useMaterialThemeOnItemPage,
|
||||
bool useCurrentPlayerThemeThroughoutApp});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -495,8 +497,8 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
|||
Object? highContrast = null,
|
||||
Object? useMaterialThemeFromSystem = null,
|
||||
Object? customThemeColor = null,
|
||||
Object? useMaterialThemeOfPlayingItem = null,
|
||||
Object? useMaterialThemeOnItemPage = null,
|
||||
Object? useCurrentPlayerThemeThroughoutApp = null,
|
||||
}) {
|
||||
return _then(_$ThemeSettingsImpl(
|
||||
themeMode: null == themeMode
|
||||
|
|
@ -515,14 +517,15 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
|||
? _value.customThemeColor
|
||||
: customThemeColor // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
useMaterialThemeOfPlayingItem: null == useMaterialThemeOfPlayingItem
|
||||
? _value.useMaterialThemeOfPlayingItem
|
||||
: useMaterialThemeOfPlayingItem // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
|
||||
? _value.useMaterialThemeOnItemPage
|
||||
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
useCurrentPlayerThemeThroughoutApp: null ==
|
||||
useCurrentPlayerThemeThroughoutApp
|
||||
? _value.useCurrentPlayerThemeThroughoutApp
|
||||
: useCurrentPlayerThemeThroughoutApp // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -535,8 +538,8 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
|||
this.highContrast = false,
|
||||
this.useMaterialThemeFromSystem = false,
|
||||
this.customThemeColor = '#FF311B92',
|
||||
this.useMaterialThemeOfPlayingItem = true,
|
||||
this.useMaterialThemeOnItemPage = true});
|
||||
this.useMaterialThemeOnItemPage = true,
|
||||
this.useCurrentPlayerThemeThroughoutApp = true});
|
||||
|
||||
factory _$ThemeSettingsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ThemeSettingsImplFromJson(json);
|
||||
|
|
@ -555,14 +558,14 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
|||
final String customThemeColor;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool useMaterialThemeOfPlayingItem;
|
||||
final bool useMaterialThemeOnItemPage;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool useMaterialThemeOnItemPage;
|
||||
final bool useCurrentPlayerThemeThroughoutApp;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ThemeSettings(themeMode: $themeMode, highContrast: $highContrast, useMaterialThemeFromSystem: $useMaterialThemeFromSystem, customThemeColor: $customThemeColor, useMaterialThemeOfPlayingItem: $useMaterialThemeOfPlayingItem, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage)';
|
||||
return 'ThemeSettings(themeMode: $themeMode, highContrast: $highContrast, useMaterialThemeFromSystem: $useMaterialThemeFromSystem, customThemeColor: $customThemeColor, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)';
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -580,14 +583,14 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
|||
useMaterialThemeFromSystem) &&
|
||||
(identical(other.customThemeColor, customThemeColor) ||
|
||||
other.customThemeColor == customThemeColor) &&
|
||||
(identical(other.useMaterialThemeOfPlayingItem,
|
||||
useMaterialThemeOfPlayingItem) ||
|
||||
other.useMaterialThemeOfPlayingItem ==
|
||||
useMaterialThemeOfPlayingItem) &&
|
||||
(identical(other.useMaterialThemeOnItemPage,
|
||||
useMaterialThemeOnItemPage) ||
|
||||
other.useMaterialThemeOnItemPage ==
|
||||
useMaterialThemeOnItemPage));
|
||||
useMaterialThemeOnItemPage) &&
|
||||
(identical(other.useCurrentPlayerThemeThroughoutApp,
|
||||
useCurrentPlayerThemeThroughoutApp) ||
|
||||
other.useCurrentPlayerThemeThroughoutApp ==
|
||||
useCurrentPlayerThemeThroughoutApp));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
|
|
@ -598,8 +601,8 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
|||
highContrast,
|
||||
useMaterialThemeFromSystem,
|
||||
customThemeColor,
|
||||
useMaterialThemeOfPlayingItem,
|
||||
useMaterialThemeOnItemPage);
|
||||
useMaterialThemeOnItemPage,
|
||||
useCurrentPlayerThemeThroughoutApp);
|
||||
|
||||
/// Create a copy of ThemeSettings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
@ -623,8 +626,8 @@ abstract class _ThemeSettings implements ThemeSettings {
|
|||
final bool highContrast,
|
||||
final bool useMaterialThemeFromSystem,
|
||||
final String customThemeColor,
|
||||
final bool useMaterialThemeOfPlayingItem,
|
||||
final bool useMaterialThemeOnItemPage}) = _$ThemeSettingsImpl;
|
||||
final bool useMaterialThemeOnItemPage,
|
||||
final bool useCurrentPlayerThemeThroughoutApp}) = _$ThemeSettingsImpl;
|
||||
|
||||
factory _ThemeSettings.fromJson(Map<String, dynamic> json) =
|
||||
_$ThemeSettingsImpl.fromJson;
|
||||
|
|
@ -638,9 +641,9 @@ abstract class _ThemeSettings implements ThemeSettings {
|
|||
@override
|
||||
String get customThemeColor;
|
||||
@override
|
||||
bool get useMaterialThemeOfPlayingItem;
|
||||
@override
|
||||
bool get useMaterialThemeOnItemPage;
|
||||
@override
|
||||
bool get useCurrentPlayerThemeThroughoutApp;
|
||||
|
||||
/// Create a copy of ThemeSettings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ _$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
|
|||
useMaterialThemeFromSystem:
|
||||
json['useMaterialThemeFromSystem'] as bool? ?? false,
|
||||
customThemeColor: json['customThemeColor'] as String? ?? '#FF311B92',
|
||||
useMaterialThemeOfPlayingItem:
|
||||
json['useMaterialThemeOfPlayingItem'] as bool? ?? true,
|
||||
useMaterialThemeOnItemPage:
|
||||
json['useMaterialThemeOnItemPage'] as bool? ?? true,
|
||||
useCurrentPlayerThemeThroughoutApp:
|
||||
json['useCurrentPlayerThemeThroughoutApp'] as bool? ?? true,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) =>
|
||||
|
|
@ -64,8 +64,9 @@ Map<String, dynamic> _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) =>
|
|||
'highContrast': instance.highContrast,
|
||||
'useMaterialThemeFromSystem': instance.useMaterialThemeFromSystem,
|
||||
'customThemeColor': instance.customThemeColor,
|
||||
'useMaterialThemeOfPlayingItem': instance.useMaterialThemeOfPlayingItem,
|
||||
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
|
||||
'useCurrentPlayerThemeThroughoutApp':
|
||||
instance.useCurrentPlayerThemeThroughoutApp,
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
|
|
|
|||
|
|
@ -158,18 +158,18 @@ class ThemeSettingsPage extends HookConsumerWidget {
|
|||
|
||||
// use theme throughout the app when playing item
|
||||
SettingsTile.switchTile(
|
||||
initialValue: themeSettings.useMaterialThemeOfPlayingItem,
|
||||
initialValue: themeSettings.useCurrentPlayerThemeThroughoutApp,
|
||||
title: const Text('Adapt theme from currently playing item'),
|
||||
description: const Text(
|
||||
'Use the theme colors from the currently playing item for the app',
|
||||
),
|
||||
leading: themeSettings.useMaterialThemeOfPlayingItem
|
||||
leading: themeSettings.useCurrentPlayerThemeThroughoutApp
|
||||
? const Icon(Icons.auto_fix_high)
|
||||
: const Icon(Icons.auto_fix_off),
|
||||
onToggle: (value) {
|
||||
ref.read(appSettingsProvider.notifier).update(
|
||||
appSettings.copyWith.themeSettings(
|
||||
useMaterialThemeOfPlayingItem: value,
|
||||
useCurrentPlayerThemeThroughoutApp: value,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue