mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-11 13:39:29 +00:00
feat: Add useCurrentPlayerThemeThroughoutApp setting to ThemeSettings
This commit is contained in:
parent
74e0d77cf9
commit
3e405b795d
4 changed files with 54 additions and 19 deletions
|
|
@ -55,7 +55,7 @@ void main() async {
|
||||||
// run the app
|
// run the app
|
||||||
runApp(
|
runApp(
|
||||||
const ProviderScope(
|
const ProviderScope(
|
||||||
child: MyApp(),
|
child: _EagerInitialization(child: MyApp()),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -76,16 +76,14 @@ class MyApp extends ConsumerWidget {
|
||||||
routerConfig.goNamed(Routes.onboarding.name);
|
routerConfig.goNamed(Routes.onboarding.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _EagerInitialization(
|
return MaterialApp.router(
|
||||||
child: MaterialApp.router(
|
// debugShowCheckedModeBanner: false,
|
||||||
// debugShowCheckedModeBanner: false,
|
theme: lightTheme,
|
||||||
theme: lightTheme,
|
darkTheme: darkTheme,
|
||||||
darkTheme: darkTheme,
|
themeMode: ref.watch(appSettingsProvider).themeSettings.isDarkMode
|
||||||
themeMode: ref.watch(appSettingsProvider).themeSettings.isDarkMode
|
? ThemeMode.dark
|
||||||
? ThemeMode.dark
|
: ThemeMode.light,
|
||||||
: ThemeMode.light,
|
routerConfig: routerConfig,
|
||||||
routerConfig: routerConfig,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ class ThemeSettings with _$ThemeSettings {
|
||||||
const factory ThemeSettings({
|
const factory ThemeSettings({
|
||||||
@Default(true) bool isDarkMode,
|
@Default(true) bool isDarkMode,
|
||||||
@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) =>
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,8 @@ ThemeSettings _$ThemeSettingsFromJson(Map<String, dynamic> json) {
|
||||||
mixin _$ThemeSettings {
|
mixin _$ThemeSettings {
|
||||||
bool get isDarkMode => throw _privateConstructorUsedError;
|
bool get isDarkMode => throw _privateConstructorUsedError;
|
||||||
bool get useMaterialThemeOnItemPage => throw _privateConstructorUsedError;
|
bool get useMaterialThemeOnItemPage => throw _privateConstructorUsedError;
|
||||||
|
bool get useCurrentPlayerThemeThroughoutApp =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
|
|
@ -257,7 +259,10 @@ abstract class $ThemeSettingsCopyWith<$Res> {
|
||||||
ThemeSettings value, $Res Function(ThemeSettings) then) =
|
ThemeSettings value, $Res Function(ThemeSettings) then) =
|
||||||
_$ThemeSettingsCopyWithImpl<$Res, ThemeSettings>;
|
_$ThemeSettingsCopyWithImpl<$Res, ThemeSettings>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({bool isDarkMode, bool useMaterialThemeOnItemPage});
|
$Res call(
|
||||||
|
{bool isDarkMode,
|
||||||
|
bool useMaterialThemeOnItemPage,
|
||||||
|
bool useCurrentPlayerThemeThroughoutApp});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
@ -275,6 +280,7 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? isDarkMode = null,
|
Object? isDarkMode = null,
|
||||||
Object? useMaterialThemeOnItemPage = null,
|
Object? useMaterialThemeOnItemPage = null,
|
||||||
|
Object? useCurrentPlayerThemeThroughoutApp = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
isDarkMode: null == isDarkMode
|
isDarkMode: null == isDarkMode
|
||||||
|
|
@ -285,6 +291,11 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
|
||||||
? _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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +308,10 @@ abstract class _$$ThemeSettingsImplCopyWith<$Res>
|
||||||
__$$ThemeSettingsImplCopyWithImpl<$Res>;
|
__$$ThemeSettingsImplCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({bool isDarkMode, bool useMaterialThemeOnItemPage});
|
$Res call(
|
||||||
|
{bool isDarkMode,
|
||||||
|
bool useMaterialThemeOnItemPage,
|
||||||
|
bool useCurrentPlayerThemeThroughoutApp});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
@ -313,6 +327,7 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? isDarkMode = null,
|
Object? isDarkMode = null,
|
||||||
Object? useMaterialThemeOnItemPage = null,
|
Object? useMaterialThemeOnItemPage = null,
|
||||||
|
Object? useCurrentPlayerThemeThroughoutApp = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$ThemeSettingsImpl(
|
return _then(_$ThemeSettingsImpl(
|
||||||
isDarkMode: null == isDarkMode
|
isDarkMode: null == isDarkMode
|
||||||
|
|
@ -323,6 +338,11 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
||||||
? _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,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +351,9 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class _$ThemeSettingsImpl implements _ThemeSettings {
|
class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
const _$ThemeSettingsImpl(
|
const _$ThemeSettingsImpl(
|
||||||
{this.isDarkMode = true, this.useMaterialThemeOnItemPage = true});
|
{this.isDarkMode = 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);
|
||||||
|
|
@ -342,10 +364,13 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
final bool useMaterialThemeOnItemPage;
|
final bool useMaterialThemeOnItemPage;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool useCurrentPlayerThemeThroughoutApp;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ThemeSettings(isDarkMode: $isDarkMode, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage)';
|
return 'ThemeSettings(isDarkMode: $isDarkMode, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -358,13 +383,17 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
(identical(other.useMaterialThemeOnItemPage,
|
(identical(other.useMaterialThemeOnItemPage,
|
||||||
useMaterialThemeOnItemPage) ||
|
useMaterialThemeOnItemPage) ||
|
||||||
other.useMaterialThemeOnItemPage ==
|
other.useMaterialThemeOnItemPage ==
|
||||||
useMaterialThemeOnItemPage));
|
useMaterialThemeOnItemPage) &&
|
||||||
|
(identical(other.useCurrentPlayerThemeThroughoutApp,
|
||||||
|
useCurrentPlayerThemeThroughoutApp) ||
|
||||||
|
other.useCurrentPlayerThemeThroughoutApp ==
|
||||||
|
useCurrentPlayerThemeThroughoutApp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => Object.hash(runtimeType, isDarkMode,
|
||||||
Object.hash(runtimeType, isDarkMode, useMaterialThemeOnItemPage);
|
useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
|
|
@ -383,7 +412,8 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
abstract class _ThemeSettings implements ThemeSettings {
|
abstract class _ThemeSettings implements ThemeSettings {
|
||||||
const factory _ThemeSettings(
|
const factory _ThemeSettings(
|
||||||
{final bool isDarkMode,
|
{final bool isDarkMode,
|
||||||
final bool useMaterialThemeOnItemPage}) = _$ThemeSettingsImpl;
|
final bool useMaterialThemeOnItemPage,
|
||||||
|
final bool useCurrentPlayerThemeThroughoutApp}) = _$ThemeSettingsImpl;
|
||||||
|
|
||||||
factory _ThemeSettings.fromJson(Map<String, dynamic> json) =
|
factory _ThemeSettings.fromJson(Map<String, dynamic> json) =
|
||||||
_$ThemeSettingsImpl.fromJson;
|
_$ThemeSettingsImpl.fromJson;
|
||||||
|
|
@ -393,6 +423,8 @@ abstract class _ThemeSettings implements ThemeSettings {
|
||||||
@override
|
@override
|
||||||
bool get useMaterialThemeOnItemPage;
|
bool get useMaterialThemeOnItemPage;
|
||||||
@override
|
@override
|
||||||
|
bool get useCurrentPlayerThemeThroughoutApp;
|
||||||
|
@override
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
_$$ThemeSettingsImplCopyWith<_$ThemeSettingsImpl> get copyWith =>
|
_$$ThemeSettingsImplCopyWith<_$ThemeSettingsImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,16 @@ _$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
|
||||||
isDarkMode: json['isDarkMode'] as bool? ?? true,
|
isDarkMode: json['isDarkMode'] 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) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'isDarkMode': instance.isDarkMode,
|
'isDarkMode': instance.isDarkMode,
|
||||||
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
|
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
|
||||||
|
'useCurrentPlayerThemeThroughoutApp':
|
||||||
|
instance.useCurrentPlayerThemeThroughoutApp,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) =>
|
_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue