mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-07-06 17:31:33 +00:00
feat: integrate dynamic color support and enhance theme settings management
This commit is contained in:
parent
dc263267be
commit
0437ca110c
11 changed files with 225 additions and 30 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
@ -51,24 +52,58 @@ class MyApp extends ConsumerWidget {
|
||||||
if (needOnboarding) {
|
if (needOnboarding) {
|
||||||
routerConfig.goNamed(Routes.onboarding.name);
|
routerConfig.goNamed(Routes.onboarding.name);
|
||||||
}
|
}
|
||||||
|
final appSettings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
try {
|
final themeSettings = appSettings.themeSettings;
|
||||||
return MaterialApp.router(
|
return DynamicColorBuilder(
|
||||||
// debugShowCheckedModeBanner: false,
|
builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
||||||
theme: brandLightTheme,
|
// Decide on a colour/brightness scheme based on OS and user settings
|
||||||
darkTheme: brandDarkTheme,
|
ColorScheme lightColorScheme;
|
||||||
themeMode: ref.watch(appSettingsProvider).themeSettings.isDarkMode
|
ColorScheme darkColorScheme;
|
||||||
? ThemeMode.dark
|
if (lightDynamic != null &&
|
||||||
: ThemeMode.light,
|
darkDynamic != null &&
|
||||||
routerConfig: routerConfig,
|
themeSettings.useMaterialThemeFromSystem) {
|
||||||
);
|
lightColorScheme = lightDynamic.harmonized();
|
||||||
} catch (e) {
|
darkColorScheme = darkDynamic.harmonized();
|
||||||
debugPrintStack(stackTrace: StackTrace.current, label: e.toString());
|
} else {
|
||||||
if (needOnboarding) {
|
lightColorScheme = brandLightColorScheme;
|
||||||
routerConfig.goNamed(Routes.onboarding.name);
|
darkColorScheme = brandDarkColorScheme;
|
||||||
}
|
}
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
// set the background and surface colors to pure black in the amoled theme
|
||||||
|
if (themeSettings.highContrast) {
|
||||||
|
darkColorScheme =
|
||||||
|
darkColorScheme.copyWith(surface: Colors.black).harmonized();
|
||||||
|
}
|
||||||
|
|
||||||
|
final themeLight = ThemeData(
|
||||||
|
useMaterial3: true,
|
||||||
|
colorScheme: lightColorScheme,
|
||||||
|
);
|
||||||
|
final themeDark = ThemeData(
|
||||||
|
useMaterial3: true,
|
||||||
|
colorScheme: darkColorScheme,
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MaterialApp.router(
|
||||||
|
// debugShowCheckedModeBanner: false,
|
||||||
|
theme: themeLight,
|
||||||
|
darkTheme: themeDark,
|
||||||
|
themeMode:
|
||||||
|
themeSettings.isDarkMode ? ThemeMode.dark : ThemeMode.light,
|
||||||
|
routerConfig: routerConfig,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
debugPrintStack(stackTrace: StackTrace.current, label: e.toString());
|
||||||
|
if (needOnboarding) {
|
||||||
|
routerConfig.goNamed(Routes.onboarding.name);
|
||||||
|
}
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,17 @@ class AppSettings with _$AppSettings {
|
||||||
_$AppSettingsFromJson(json);
|
_$AppSettingsFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ThemeType { light, dark, system }
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class ThemeSettings with _$ThemeSettings {
|
class ThemeSettings with _$ThemeSettings {
|
||||||
const factory ThemeSettings({
|
const factory ThemeSettings({
|
||||||
@Default(true) bool isDarkMode,
|
@Default(true) bool isDarkMode,
|
||||||
|
@Default(ThemeType.system) ThemeType themeType,
|
||||||
|
@Default(false) bool highContrast,
|
||||||
|
@Default(true) bool useMaterialThemeFromSystem,
|
||||||
|
@Default('#FF311B92') String customThemeColor,
|
||||||
|
@Default(true) bool useMaterialThemeOfPlayingItem,
|
||||||
@Default(true) bool useMaterialThemeOnItemPage,
|
@Default(true) bool useMaterialThemeOnItemPage,
|
||||||
@Default(true) bool useCurrentPlayerThemeThroughoutApp,
|
@Default(true) bool useCurrentPlayerThemeThroughoutApp,
|
||||||
}) = _ThemeSettings;
|
}) = _ThemeSettings;
|
||||||
|
|
|
||||||
|
|
@ -379,6 +379,11 @@ ThemeSettings _$ThemeSettingsFromJson(Map<String, dynamic> json) {
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$ThemeSettings {
|
mixin _$ThemeSettings {
|
||||||
bool get isDarkMode => throw _privateConstructorUsedError;
|
bool get isDarkMode => throw _privateConstructorUsedError;
|
||||||
|
ThemeType get themeType => throw _privateConstructorUsedError;
|
||||||
|
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 useMaterialThemeOnItemPage => throw _privateConstructorUsedError;
|
||||||
bool get useCurrentPlayerThemeThroughoutApp =>
|
bool get useCurrentPlayerThemeThroughoutApp =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
|
|
@ -401,6 +406,11 @@ abstract class $ThemeSettingsCopyWith<$Res> {
|
||||||
@useResult
|
@useResult
|
||||||
$Res call(
|
$Res call(
|
||||||
{bool isDarkMode,
|
{bool isDarkMode,
|
||||||
|
ThemeType themeType,
|
||||||
|
bool highContrast,
|
||||||
|
bool useMaterialThemeFromSystem,
|
||||||
|
String customThemeColor,
|
||||||
|
bool useMaterialThemeOfPlayingItem,
|
||||||
bool useMaterialThemeOnItemPage,
|
bool useMaterialThemeOnItemPage,
|
||||||
bool useCurrentPlayerThemeThroughoutApp});
|
bool useCurrentPlayerThemeThroughoutApp});
|
||||||
}
|
}
|
||||||
|
|
@ -421,6 +431,11 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? isDarkMode = null,
|
Object? isDarkMode = null,
|
||||||
|
Object? themeType = null,
|
||||||
|
Object? highContrast = null,
|
||||||
|
Object? useMaterialThemeFromSystem = null,
|
||||||
|
Object? customThemeColor = null,
|
||||||
|
Object? useMaterialThemeOfPlayingItem = null,
|
||||||
Object? useMaterialThemeOnItemPage = null,
|
Object? useMaterialThemeOnItemPage = null,
|
||||||
Object? useCurrentPlayerThemeThroughoutApp = null,
|
Object? useCurrentPlayerThemeThroughoutApp = null,
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -429,6 +444,26 @@ class _$ThemeSettingsCopyWithImpl<$Res, $Val extends ThemeSettings>
|
||||||
? _value.isDarkMode
|
? _value.isDarkMode
|
||||||
: isDarkMode // ignore: cast_nullable_to_non_nullable
|
: isDarkMode // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
themeType: null == themeType
|
||||||
|
? _value.themeType
|
||||||
|
: themeType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ThemeType,
|
||||||
|
highContrast: null == highContrast
|
||||||
|
? _value.highContrast
|
||||||
|
: highContrast // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
useMaterialThemeFromSystem: null == useMaterialThemeFromSystem
|
||||||
|
? _value.useMaterialThemeFromSystem
|
||||||
|
: useMaterialThemeFromSystem // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
customThemeColor: null == customThemeColor
|
||||||
|
? _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
|
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
|
||||||
? _value.useMaterialThemeOnItemPage
|
? _value.useMaterialThemeOnItemPage
|
||||||
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
|
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
|
||||||
|
|
@ -452,6 +487,11 @@ abstract class _$$ThemeSettingsImplCopyWith<$Res>
|
||||||
@useResult
|
@useResult
|
||||||
$Res call(
|
$Res call(
|
||||||
{bool isDarkMode,
|
{bool isDarkMode,
|
||||||
|
ThemeType themeType,
|
||||||
|
bool highContrast,
|
||||||
|
bool useMaterialThemeFromSystem,
|
||||||
|
String customThemeColor,
|
||||||
|
bool useMaterialThemeOfPlayingItem,
|
||||||
bool useMaterialThemeOnItemPage,
|
bool useMaterialThemeOnItemPage,
|
||||||
bool useCurrentPlayerThemeThroughoutApp});
|
bool useCurrentPlayerThemeThroughoutApp});
|
||||||
}
|
}
|
||||||
|
|
@ -470,6 +510,11 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? isDarkMode = null,
|
Object? isDarkMode = null,
|
||||||
|
Object? themeType = null,
|
||||||
|
Object? highContrast = null,
|
||||||
|
Object? useMaterialThemeFromSystem = null,
|
||||||
|
Object? customThemeColor = null,
|
||||||
|
Object? useMaterialThemeOfPlayingItem = null,
|
||||||
Object? useMaterialThemeOnItemPage = null,
|
Object? useMaterialThemeOnItemPage = null,
|
||||||
Object? useCurrentPlayerThemeThroughoutApp = null,
|
Object? useCurrentPlayerThemeThroughoutApp = null,
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -478,6 +523,26 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
||||||
? _value.isDarkMode
|
? _value.isDarkMode
|
||||||
: isDarkMode // ignore: cast_nullable_to_non_nullable
|
: isDarkMode // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
themeType: null == themeType
|
||||||
|
? _value.themeType
|
||||||
|
: themeType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ThemeType,
|
||||||
|
highContrast: null == highContrast
|
||||||
|
? _value.highContrast
|
||||||
|
: highContrast // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
useMaterialThemeFromSystem: null == useMaterialThemeFromSystem
|
||||||
|
? _value.useMaterialThemeFromSystem
|
||||||
|
: useMaterialThemeFromSystem // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
customThemeColor: null == customThemeColor
|
||||||
|
? _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
|
useMaterialThemeOnItemPage: null == useMaterialThemeOnItemPage
|
||||||
? _value.useMaterialThemeOnItemPage
|
? _value.useMaterialThemeOnItemPage
|
||||||
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
|
: useMaterialThemeOnItemPage // ignore: cast_nullable_to_non_nullable
|
||||||
|
|
@ -496,6 +561,11 @@ class __$$ThemeSettingsImplCopyWithImpl<$Res>
|
||||||
class _$ThemeSettingsImpl implements _ThemeSettings {
|
class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
const _$ThemeSettingsImpl(
|
const _$ThemeSettingsImpl(
|
||||||
{this.isDarkMode = true,
|
{this.isDarkMode = true,
|
||||||
|
this.themeType = ThemeType.system,
|
||||||
|
this.highContrast = false,
|
||||||
|
this.useMaterialThemeFromSystem = true,
|
||||||
|
this.customThemeColor = '#FF311B92',
|
||||||
|
this.useMaterialThemeOfPlayingItem = true,
|
||||||
this.useMaterialThemeOnItemPage = true,
|
this.useMaterialThemeOnItemPage = true,
|
||||||
this.useCurrentPlayerThemeThroughoutApp = true});
|
this.useCurrentPlayerThemeThroughoutApp = true});
|
||||||
|
|
||||||
|
|
@ -507,6 +577,21 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
final bool isDarkMode;
|
final bool isDarkMode;
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
|
final ThemeType themeType;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool highContrast;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool useMaterialThemeFromSystem;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final String customThemeColor;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool useMaterialThemeOfPlayingItem;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
final bool useMaterialThemeOnItemPage;
|
final bool useMaterialThemeOnItemPage;
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
|
|
@ -514,7 +599,7 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ThemeSettings(isDarkMode: $isDarkMode, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)';
|
return 'ThemeSettings(isDarkMode: $isDarkMode, themeType: $themeType, highContrast: $highContrast, useMaterialThemeFromSystem: $useMaterialThemeFromSystem, customThemeColor: $customThemeColor, useMaterialThemeOfPlayingItem: $useMaterialThemeOfPlayingItem, useMaterialThemeOnItemPage: $useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp: $useCurrentPlayerThemeThroughoutApp)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -524,6 +609,20 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
other is _$ThemeSettingsImpl &&
|
other is _$ThemeSettingsImpl &&
|
||||||
(identical(other.isDarkMode, isDarkMode) ||
|
(identical(other.isDarkMode, isDarkMode) ||
|
||||||
other.isDarkMode == isDarkMode) &&
|
other.isDarkMode == isDarkMode) &&
|
||||||
|
(identical(other.themeType, themeType) ||
|
||||||
|
other.themeType == themeType) &&
|
||||||
|
(identical(other.highContrast, highContrast) ||
|
||||||
|
other.highContrast == highContrast) &&
|
||||||
|
(identical(other.useMaterialThemeFromSystem,
|
||||||
|
useMaterialThemeFromSystem) ||
|
||||||
|
other.useMaterialThemeFromSystem ==
|
||||||
|
useMaterialThemeFromSystem) &&
|
||||||
|
(identical(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 ==
|
||||||
|
|
@ -536,8 +635,16 @@ class _$ThemeSettingsImpl implements _ThemeSettings {
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, isDarkMode,
|
int get hashCode => Object.hash(
|
||||||
useMaterialThemeOnItemPage, useCurrentPlayerThemeThroughoutApp);
|
runtimeType,
|
||||||
|
isDarkMode,
|
||||||
|
themeType,
|
||||||
|
highContrast,
|
||||||
|
useMaterialThemeFromSystem,
|
||||||
|
customThemeColor,
|
||||||
|
useMaterialThemeOfPlayingItem,
|
||||||
|
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.
|
||||||
|
|
@ -558,6 +665,11 @@ 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 ThemeType themeType,
|
||||||
|
final bool highContrast,
|
||||||
|
final bool useMaterialThemeFromSystem,
|
||||||
|
final String customThemeColor,
|
||||||
|
final bool useMaterialThemeOfPlayingItem,
|
||||||
final bool useMaterialThemeOnItemPage,
|
final bool useMaterialThemeOnItemPage,
|
||||||
final bool useCurrentPlayerThemeThroughoutApp}) = _$ThemeSettingsImpl;
|
final bool useCurrentPlayerThemeThroughoutApp}) = _$ThemeSettingsImpl;
|
||||||
|
|
||||||
|
|
@ -567,6 +679,16 @@ abstract class _ThemeSettings implements ThemeSettings {
|
||||||
@override
|
@override
|
||||||
bool get isDarkMode;
|
bool get isDarkMode;
|
||||||
@override
|
@override
|
||||||
|
ThemeType get themeType;
|
||||||
|
@override
|
||||||
|
bool get highContrast;
|
||||||
|
@override
|
||||||
|
bool get useMaterialThemeFromSystem;
|
||||||
|
@override
|
||||||
|
String get customThemeColor;
|
||||||
|
@override
|
||||||
|
bool get useMaterialThemeOfPlayingItem;
|
||||||
|
@override
|
||||||
bool get useMaterialThemeOnItemPage;
|
bool get useMaterialThemeOnItemPage;
|
||||||
@override
|
@override
|
||||||
bool get useCurrentPlayerThemeThroughoutApp;
|
bool get useCurrentPlayerThemeThroughoutApp;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,14 @@ Map<String, dynamic> _$$AppSettingsImplToJson(_$AppSettingsImpl instance) =>
|
||||||
_$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
|
_$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
|
||||||
_$ThemeSettingsImpl(
|
_$ThemeSettingsImpl(
|
||||||
isDarkMode: json['isDarkMode'] as bool? ?? true,
|
isDarkMode: json['isDarkMode'] as bool? ?? true,
|
||||||
|
themeType: $enumDecodeNullable(_$ThemeTypeEnumMap, json['themeType']) ??
|
||||||
|
ThemeType.system,
|
||||||
|
highContrast: json['highContrast'] as bool? ?? false,
|
||||||
|
useMaterialThemeFromSystem:
|
||||||
|
json['useMaterialThemeFromSystem'] as bool? ?? true,
|
||||||
|
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:
|
useCurrentPlayerThemeThroughoutApp:
|
||||||
|
|
@ -56,11 +64,22 @@ _$ThemeSettingsImpl _$$ThemeSettingsImplFromJson(Map<String, dynamic> json) =>
|
||||||
Map<String, dynamic> _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) =>
|
Map<String, dynamic> _$$ThemeSettingsImplToJson(_$ThemeSettingsImpl instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'isDarkMode': instance.isDarkMode,
|
'isDarkMode': instance.isDarkMode,
|
||||||
|
'themeType': _$ThemeTypeEnumMap[instance.themeType]!,
|
||||||
|
'highContrast': instance.highContrast,
|
||||||
|
'useMaterialThemeFromSystem': instance.useMaterialThemeFromSystem,
|
||||||
|
'customThemeColor': instance.customThemeColor,
|
||||||
|
'useMaterialThemeOfPlayingItem': instance.useMaterialThemeOfPlayingItem,
|
||||||
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
|
'useMaterialThemeOnItemPage': instance.useMaterialThemeOnItemPage,
|
||||||
'useCurrentPlayerThemeThroughoutApp':
|
'useCurrentPlayerThemeThroughoutApp':
|
||||||
instance.useCurrentPlayerThemeThroughoutApp,
|
instance.useCurrentPlayerThemeThroughoutApp,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _$ThemeTypeEnumMap = {
|
||||||
|
ThemeType.light: 'light',
|
||||||
|
ThemeType.dark: 'dark',
|
||||||
|
ThemeType.system: 'system',
|
||||||
|
};
|
||||||
|
|
||||||
_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) =>
|
_$PlayerSettingsImpl _$$PlayerSettingsImplFromJson(Map<String, dynamic> json) =>
|
||||||
_$PlayerSettingsImpl(
|
_$PlayerSettingsImpl(
|
||||||
miniPlayerSettings: json['miniPlayerSettings'] == null
|
miniPlayerSettings: json['miniPlayerSettings'] == null
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,12 @@ import 'package:flutter/material.dart';
|
||||||
const brandColor = Color(0xFF311B92);
|
const brandColor = Color(0xFF311B92);
|
||||||
const brandColorLight = Color(0xFF604CEC);
|
const brandColorLight = Color(0xFF604CEC);
|
||||||
|
|
||||||
final ThemeData brandLightTheme = ThemeData(
|
final brandLightColorScheme = ColorScheme.fromSeed(
|
||||||
|
seedColor: brandColor,
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
colorScheme: ColorScheme.fromSeed(
|
|
||||||
seedColor: brandColor,
|
|
||||||
brightness: Brightness.light,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final ThemeData brandDarkTheme = ThemeData(
|
final brandDarkColorScheme = ColorScheme.fromSeed(
|
||||||
|
seedColor: brandColor,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
colorScheme: ColorScheme.fromSeed(
|
|
||||||
seedColor: brandColor,
|
|
||||||
brightness: Brightness.dark,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,15 @@
|
||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <dynamic_color/dynamic_color_plugin.h>
|
||||||
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
||||||
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
|
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
|
||||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||||
|
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar =
|
g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin");
|
||||||
isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar);
|
isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
dynamic_color
|
||||||
isar_flutter_libs
|
isar_flutter_libs
|
||||||
media_kit_libs_linux
|
media_kit_libs_linux
|
||||||
url_launcher_linux
|
url_launcher_linux
|
||||||
|
|
|
||||||
|
|
@ -390,6 +390,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.0"
|
||||||
|
dynamic_color:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dynamic_color
|
||||||
|
sha256: eae98052fa6e2826bdac3dd2e921c6ce2903be15c6b7f8b6d8a5d49b5086298d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.7.0"
|
||||||
easy_stepper:
|
easy_stepper:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ dependencies:
|
||||||
cupertino_icons: ^1.0.6
|
cupertino_icons: ^1.0.6
|
||||||
device_info_plus: ^10.1.0
|
device_info_plus: ^10.1.0
|
||||||
duration_picker: ^1.2.0
|
duration_picker: ^1.2.0
|
||||||
|
dynamic_color: ^1.7.0
|
||||||
easy_stepper: ^0.8.4
|
easy_stepper: ^0.8.4
|
||||||
file_picker: ^8.1.2
|
file_picker: ^8.1.2
|
||||||
flutter:
|
flutter:
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
||||||
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
||||||
#include <media_kit_libs_windows_audio/media_kit_libs_windows_audio_plugin_c_api.h>
|
#include <media_kit_libs_windows_audio/media_kit_libs_windows_audio_plugin_c_api.h>
|
||||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||||
|
|
@ -13,6 +14,8 @@
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
DynamicColorPluginCApiRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||||
IsarFlutterLibsPluginRegisterWithRegistrar(
|
IsarFlutterLibsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin"));
|
registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin"));
|
||||||
MediaKitLibsWindowsAudioPluginCApiRegisterWithRegistrar(
|
MediaKitLibsWindowsAudioPluginCApiRegisterWithRegistrar(
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
dynamic_color
|
||||||
isar_flutter_libs
|
isar_flutter_libs
|
||||||
media_kit_libs_windows_audio
|
media_kit_libs_windows_audio
|
||||||
permission_handler_windows
|
permission_handler_windows
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue