added theme setting; fixed light theme issues
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:bang_navigator/features/content_block/data/models/host.dart';
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
part 'settings.g.dart';
|
||||
|
||||
@@ -13,6 +14,7 @@ class Settings with FastEquatable {
|
||||
final bool launchUrlExternal;
|
||||
final bool enableContentBlocking;
|
||||
final Set<HostSource> enableHostList;
|
||||
final ThemeMode themeMode;
|
||||
|
||||
Settings({
|
||||
required this.kagiSession,
|
||||
@@ -22,6 +24,7 @@ class Settings with FastEquatable {
|
||||
required this.launchUrlExternal,
|
||||
required this.enableContentBlocking,
|
||||
required this.enableHostList,
|
||||
required this.themeMode,
|
||||
});
|
||||
|
||||
Settings.withDefaults({
|
||||
@@ -32,12 +35,14 @@ class Settings with FastEquatable {
|
||||
bool? launchUrlExternal,
|
||||
bool? enableContentBlocking,
|
||||
Set<HostSource>? enableHostList,
|
||||
ThemeMode? themeMode,
|
||||
}) : showEarlyAccessFeatures = showEarlyAccessFeatures ?? true,
|
||||
incognitoMode = incognitoMode ?? true,
|
||||
enableJavascript = enableJavascript ?? true,
|
||||
launchUrlExternal = launchUrlExternal ?? false,
|
||||
enableContentBlocking = enableContentBlocking ?? true,
|
||||
enableHostList = enableHostList ?? {HostSource.stevenBlackUnified};
|
||||
enableHostList = enableHostList ?? {HostSource.stevenBlackUnified},
|
||||
themeMode = themeMode ?? ThemeMode.dark;
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
@@ -51,5 +56,6 @@ class Settings with FastEquatable {
|
||||
launchUrlExternal,
|
||||
enableContentBlocking,
|
||||
enableHostList,
|
||||
themeMode,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ abstract class _$SettingsCWProxy {
|
||||
|
||||
Settings enableHostList(Set<HostSource> enableHostList);
|
||||
|
||||
Settings themeMode(ThemeMode themeMode);
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Settings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -35,6 +37,7 @@ abstract class _$SettingsCWProxy {
|
||||
bool? launchUrlExternal,
|
||||
bool? enableContentBlocking,
|
||||
Set<HostSource>? enableHostList,
|
||||
ThemeMode? themeMode,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,6 +74,9 @@ class _$SettingsCWProxyImpl implements _$SettingsCWProxy {
|
||||
Settings enableHostList(Set<HostSource> enableHostList) =>
|
||||
this(enableHostList: enableHostList);
|
||||
|
||||
@override
|
||||
Settings themeMode(ThemeMode themeMode) => this(themeMode: themeMode);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Settings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
@@ -87,6 +93,7 @@ class _$SettingsCWProxyImpl implements _$SettingsCWProxy {
|
||||
Object? launchUrlExternal = const $CopyWithPlaceholder(),
|
||||
Object? enableContentBlocking = const $CopyWithPlaceholder(),
|
||||
Object? enableHostList = const $CopyWithPlaceholder(),
|
||||
Object? themeMode = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return Settings(
|
||||
kagiSession: kagiSession == const $CopyWithPlaceholder()
|
||||
@@ -125,6 +132,10 @@ class _$SettingsCWProxyImpl implements _$SettingsCWProxy {
|
||||
? _value.enableHostList
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: enableHostList as Set<HostSource>,
|
||||
themeMode: themeMode == const $CopyWithPlaceholder() || themeMode == null
|
||||
? _value.themeMode
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: themeMode as ThemeMode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user