feat: Add useCurrentPlayerThemeThroughoutApp setting to ThemeSettings

This commit is contained in:
Dr-Blank 2024-08-20 11:52:35 -04:00
parent 74e0d77cf9
commit 3e405b795d
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
4 changed files with 54 additions and 19 deletions

View file

@ -55,7 +55,7 @@ void main() async {
// run the app
runApp(
const ProviderScope(
child: MyApp(),
child: _EagerInitialization(child: MyApp()),
),
);
}
@ -76,8 +76,7 @@ class MyApp extends ConsumerWidget {
routerConfig.goNamed(Routes.onboarding.name);
}
return _EagerInitialization(
child: MaterialApp.router(
return MaterialApp.router(
// debugShowCheckedModeBanner: false,
theme: lightTheme,
darkTheme: darkTheme,
@ -85,7 +84,6 @@ class MyApp extends ConsumerWidget {
? ThemeMode.dark
: ThemeMode.light,
routerConfig: routerConfig,
),
);
}
}

View file

@ -25,6 +25,7 @@ class ThemeSettings with _$ThemeSettings {
const factory ThemeSettings({
@Default(true) bool isDarkMode,
@Default(true) bool useMaterialThemeOnItemPage,
@Default(true) bool useCurrentPlayerThemeThroughoutApp,
}) = _ThemeSettings;
factory ThemeSettings.fromJson(Map<String, dynamic> json) =>

View file

@ -244,6 +244,8 @@ ThemeSettings _$ThemeSettingsFromJson(Map<String, dynamic> json) {
mixin _$ThemeSettings {
bool get isDarkMode => throw _privateConstructorUsedError;
bool get useMaterialThemeOnItemPage => throw _privateConstructorUsedError;
bool get useCurrentPlayerThemeThroughoutApp =>
throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
@ -257,7 +259,10 @@ abstract class $ThemeSettingsCopyWith<$Res> {
ThemeSettings value, $Res Function(ThemeSettings) then) =
_$ThemeSettingsCopyWithImpl<$Res, ThemeSettings>;
@useResult
$Res call({bool isDarkMode, bool useMaterialThemeOnItemPage});
$Res call(
{bool isDarkMode,
bool useMaterialThemeOnItemPage,
bool useCurrentPlayerThemeThroughoutApp});
}
/// @nodoc
@ -275,6 +280,7 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
$Res call({
Object? isDarkMode = null,
Object? useMaterialThemeOnItemPage = null,
Object? useCurrentPlayerThemeThroughoutApp = null,
}) {
return _then(_value.copyWith(
isDarkMode: null == isDarkMode
@ -285,6 +291,11 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
? _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);
}
}
@ -297,7 +308,10 @@ abstract class _$$ThemeSettingsImplCopyWith<$Res>
__$$ThemeSettingsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool isDarkMode, bool useMaterialThemeOnItemPage});
$Res call(
{bool isDarkMode,
bool useMaterialThemeOnItemPage,
bool useCurrentPlayerThemeThroughoutApp});
}
/// @nodoc
@ -313,6 +327,7 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
$Res call({
Object? isDarkMode = null,
Object? useMaterialThemeOnItemPage = null,
Object? useCurrentPlayerThemeThroughoutApp = null,
}) {
return _then(_$ThemeSettingsImpl(
isDarkMode: null == isDarkMode
@ -323,6 +338,11 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
? _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,
));
}
}
@ -331,7 +351,9 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
@JsonSerializable()
class _$ThemeSettingsImpl implements _ThemeSettings {
const _$ThemeSettingsImpl(
{this.isDarkMode = true, this.useMaterialThemeOnItemPage = true});
{this.isDarkMode = true,
this.useMaterialThemeOnItemPage = true,
this.useCurrentPlayerThemeThroughoutApp = true});
factory _$ThemeSettingsImpl.fromJson(Map<String, dynamic> json) =>
_$$ThemeSettingsImplFromJson(json);
@ -342,10 +364,13 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
@override
@JsonKey()
final bool useMaterialThemeOnItemPage;
@override
@JsonKey()
final bool useCurrentPlayerThemeThroughoutApp;
@override
String toString() {
return 'ThemeSettings(isDarkMode: $isDarkMode, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage)';
return 'ThemeSettings(isDarkMode: $isDarkMode, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)';
}
@override
@ -358,13 +383,17 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
(identical(other.useMaterialThemeOnItemPage,
useMaterialThemeOnItemPage) ||
other.useMaterialThemeOnItemPage ==
useMaterialThemeOnItemPage));
useMaterialThemeOnItemPage) &&
(identical(other.useCurrentPlayerThemeThroughoutApp,
useCurrentPlayerThemeThroughoutApp) ||
other.useCurrentPlayerThemeThroughoutApp ==
useCurrentPlayerThemeThroughoutApp));
}
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, isDarkMode, useMaterialThemeOnItemPage);
int get hashCode => Object.hash(runtimeType, isDarkMode,
useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp);
@JsonKey(ignore: true)
@override
@ -383,7 +412,8 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
abstract class _ThemeSettings implements ThemeSettings {
const factory _ThemeSettings(
{final bool isDarkMode,
final bool useMaterialThemeOnItemPage}) = _$ThemeSettingsImpl;
final bool useMaterialThemeOnItemPage,
final bool useCurrentPlayerThemeThroughoutApp}) = _$ThemeSettingsImpl;
factory _ThemeSettings.fromJson(Map<String, dynamic> json) =
_$ThemeSettingsImpl.fromJson;
@ -393,6 +423,8 @@ abstract class _ThemeSettings implements ThemeSettings {
@override
bool get useMaterialThemeOnItemPage;
@override
bool get useCurrentPlayerThemeThroughoutApp;
@override
@JsonKey(ignore: true)
_$$ThemeSettingsImplCopyWith<_$ThemeSettingsImpl> get copyWith =>
throw _privateConstructorUsedError;

View file

@ -34,12 +34,16 @@ _$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
isDarkMode: json['isDarkMode'] as bool? ?? true,
useMaterialThemeOnItemPage:
json['useMaterialThemeOnItemPage'] as bool? ?? true,
useCurrentPlayerThemeThroughoutApp:
json['useCurrentPlayerThemeThroughoutApp'] as bool? ?? true,
);
Map<String, dynamic> _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) =>
<String, dynamic>{
'isDarkMode': instance.isDarkMode,
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
'useCurrentPlayerThemeThroughoutApp':
instance.useCurrentPlayerThemeThroughoutApp,
};
_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) =>