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