imporved app bar; added quick actions;

This commit is contained in:
Fabian Freund
2024-07-09 09:26:21 +02:00
parent 28197ef59f
commit a38f50488c
17 changed files with 446 additions and 169 deletions
@@ -1,4 +1,5 @@
import 'package:bang_navigator/features/content_block/data/models/host.dart';
import 'package:bang_navigator/features/search_browser/domain/entities/modes.dart';
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:fast_equatable/fast_equatable.dart';
import 'package:flutter/material.dart';
@@ -16,6 +17,8 @@ class Settings with FastEquatable {
final bool blockHttpProtocol;
final Set<HostSource> enableHostList;
final ThemeMode themeMode;
final KagiTool? quickAction;
final bool quickActionVoiceInput;
Settings({
required this.kagiSession,
@@ -27,6 +30,8 @@ class Settings with FastEquatable {
required this.blockHttpProtocol,
required this.enableHostList,
required this.themeMode,
required this.quickAction,
required this.quickActionVoiceInput,
});
Settings.withDefaults({
@@ -39,6 +44,8 @@ class Settings with FastEquatable {
bool? blockHttpProtocol,
Set<HostSource>? enableHostList,
ThemeMode? themeMode,
this.quickAction,
bool? quickActionVoiceInput,
}) : showEarlyAccessFeatures = showEarlyAccessFeatures ?? true,
incognitoMode = incognitoMode ?? true,
enableJavascript = enableJavascript ?? true,
@@ -46,7 +53,8 @@ class Settings with FastEquatable {
enableContentBlocking = enableContentBlocking ?? true,
blockHttpProtocol = blockHttpProtocol ?? false,
enableHostList = enableHostList ?? {HostSource.stevenBlackUnified},
themeMode = themeMode ?? ThemeMode.dark;
themeMode = themeMode ?? ThemeMode.dark,
quickActionVoiceInput = quickActionVoiceInput ?? false;
@override
bool get cacheHash => true;
@@ -62,5 +70,7 @@ class Settings with FastEquatable {
blockHttpProtocol,
enableHostList,
themeMode,
quickAction,
quickActionVoiceInput,
];
}
@@ -25,6 +25,10 @@ abstract class _$SettingsCWProxy {
Settings themeMode(ThemeMode themeMode);
Settings quickAction(KagiTool? quickAction);
Settings quickActionVoiceInput(bool quickActionVoiceInput);
/// 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
@@ -41,6 +45,8 @@ abstract class _$SettingsCWProxy {
bool? blockHttpProtocol,
Set<HostSource>? enableHostList,
ThemeMode? themeMode,
KagiTool? quickAction,
bool? quickActionVoiceInput,
});
}
@@ -84,6 +90,13 @@ class _$SettingsCWProxyImpl implements _$SettingsCWProxy {
@override
Settings themeMode(ThemeMode themeMode) => this(themeMode: themeMode);
@override
Settings quickAction(KagiTool? quickAction) => this(quickAction: quickAction);
@override
Settings quickActionVoiceInput(bool quickActionVoiceInput) =>
this(quickActionVoiceInput: quickActionVoiceInput);
@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.
@@ -102,6 +115,8 @@ class _$SettingsCWProxyImpl implements _$SettingsCWProxy {
Object? blockHttpProtocol = const $CopyWithPlaceholder(),
Object? enableHostList = const $CopyWithPlaceholder(),
Object? themeMode = const $CopyWithPlaceholder(),
Object? quickAction = const $CopyWithPlaceholder(),
Object? quickActionVoiceInput = const $CopyWithPlaceholder(),
}) {
return Settings(
kagiSession: kagiSession == const $CopyWithPlaceholder()
@@ -149,6 +164,16 @@ class _$SettingsCWProxyImpl implements _$SettingsCWProxy {
? _value.themeMode
// ignore: cast_nullable_to_non_nullable
: themeMode as ThemeMode,
quickAction: quickAction == const $CopyWithPlaceholder()
? _value.quickAction
// ignore: cast_nullable_to_non_nullable
: quickAction as KagiTool?,
quickActionVoiceInput:
quickActionVoiceInput == const $CopyWithPlaceholder() ||
quickActionVoiceInput == null
? _value.quickActionVoiceInput
// ignore: cast_nullable_to_non_nullable
: quickActionVoiceInput as bool,
);
}
}