new home screen

This commit is contained in:
Fabian Freund
2026-08-04 16:03:30 +02:00
parent 3def036b3b
commit dbfcd1daaa
62 changed files with 6302 additions and 1496 deletions
@@ -28,6 +28,7 @@ import 'package:weblibre/features/app_links/domain/entities/app_link_rule.dart';
import 'package:weblibre/features/app_links/domain/entities/context_app_link_policy.dart';
import 'package:weblibre/features/bangs/data/models/bang_group.dart';
import 'package:weblibre/features/bangs/data/models/bang_key.dart';
import 'package:weblibre/features/geckoview/features/browser/domain/entities/home_target.dart';
import 'package:weblibre/features/intent_gatekeeper/domain/entities/intent_source_policy.dart';
import 'package:weblibre/features/search/domain/entities/abstract/i_search_suggestion_provider.dart';
@@ -157,6 +158,18 @@ class GeneralSettings with FastEquatable {
/// be dismissed without a system back button or back gesture (e.g. on e-ink
/// devices). Defaults to false. Only shown when the route can be popped.
final bool showSearchCloseButton;
/// What to land on when there is no tab to show — at cold start, and when
/// the last tab in scope is closed if [homeTargetOnLastTabClosed] is set.
final HomeTarget homeTarget;
/// Address opened when [homeTarget] is [HomeTarget.customUrl]. An unset or
/// unparseable value falls back to the home surface.
final String? homeTargetUrl;
/// Also apply [homeTarget] when the last tab in the current container is
/// closed, instead of falling through to a tab from somewhere else.
final bool homeTargetOnLastTabClosed;
@JsonKey(name: 'defaultCreateTabType')
final TabType storedDefaultCreateTabType;
final TabDirection tabListDirection;
@@ -291,6 +304,9 @@ class GeneralSettings with FastEquatable {
required this.showContainerUi,
required this.showIsolatedTabUi,
required this.showSearchCloseButton,
required this.homeTarget,
required this.homeTargetUrl,
required this.homeTargetOnLastTabClosed,
required this.storedDefaultCreateTabType,
required this.tabListDirection,
required this.tabBarDirection,
@@ -364,6 +380,9 @@ class GeneralSettings with FastEquatable {
bool? showContainerUi,
bool? showIsolatedTabUi,
bool? showSearchCloseButton,
HomeTarget? homeTarget,
this.homeTargetUrl,
bool? homeTargetOnLastTabClosed,
TabType? storedDefaultCreateTabType,
TabDirection? tabListDirection,
TabDirection? tabBarDirection,
@@ -434,6 +453,10 @@ class GeneralSettings with FastEquatable {
showContainerUi = showContainerUi ?? true,
showIsolatedTabUi = showIsolatedTabUi ?? true,
showSearchCloseButton = showSearchCloseButton ?? false,
// Defaults to `home`, which is exactly what the browser did before this
// setting existed. Anything else would change startup for every user.
homeTarget = homeTarget ?? HomeTarget.home,
homeTargetOnLastTabClosed = homeTargetOnLastTabClosed ?? false,
storedDefaultCreateTabType =
storedDefaultCreateTabType ?? TabType.regular,
tabListDirection = tabListDirection ?? TabDirection.newestFirst,
@@ -611,6 +634,9 @@ class GeneralSettings with FastEquatable {
showContainerUi,
showIsolatedTabUi,
showSearchCloseButton,
homeTarget,
homeTargetUrl,
homeTargetOnLastTabClosed,
storedDefaultCreateTabType,
tabListDirection,
tabBarDirection,
@@ -43,6 +43,12 @@ abstract class _$GeneralSettingsCWProxy {
GeneralSettings showSearchCloseButton(bool showSearchCloseButton);
GeneralSettings homeTarget(HomeTarget homeTarget);
GeneralSettings homeTargetUrl(String? homeTargetUrl);
GeneralSettings homeTargetOnLastTabClosed(bool homeTargetOnLastTabClosed);
GeneralSettings storedDefaultCreateTabType(
TabType storedDefaultCreateTabType,
);
@@ -193,6 +199,9 @@ abstract class _$GeneralSettingsCWProxy {
bool showContainerUi,
bool showIsolatedTabUi,
bool showSearchCloseButton,
HomeTarget homeTarget,
String? homeTargetUrl,
bool homeTargetOnLastTabClosed,
TabType storedDefaultCreateTabType,
TabDirection tabListDirection,
TabDirection tabBarDirection,
@@ -323,6 +332,18 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
GeneralSettings showSearchCloseButton(bool showSearchCloseButton) =>
call(showSearchCloseButton: showSearchCloseButton);
@override
GeneralSettings homeTarget(HomeTarget homeTarget) =>
call(homeTarget: homeTarget);
@override
GeneralSettings homeTargetUrl(String? homeTargetUrl) =>
call(homeTargetUrl: homeTargetUrl);
@override
GeneralSettings homeTargetOnLastTabClosed(bool homeTargetOnLastTabClosed) =>
call(homeTargetOnLastTabClosed: homeTargetOnLastTabClosed);
@override
GeneralSettings storedDefaultCreateTabType(
TabType storedDefaultCreateTabType,
@@ -582,6 +603,9 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
Object? showContainerUi = const $CopyWithPlaceholder(),
Object? showIsolatedTabUi = const $CopyWithPlaceholder(),
Object? showSearchCloseButton = const $CopyWithPlaceholder(),
Object? homeTarget = const $CopyWithPlaceholder(),
Object? homeTargetUrl = const $CopyWithPlaceholder(),
Object? homeTargetOnLastTabClosed = const $CopyWithPlaceholder(),
Object? storedDefaultCreateTabType = const $CopyWithPlaceholder(),
Object? tabListDirection = const $CopyWithPlaceholder(),
Object? tabBarDirection = const $CopyWithPlaceholder(),
@@ -731,6 +755,21 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
? _value.showSearchCloseButton
// ignore: cast_nullable_to_non_nullable
: showSearchCloseButton as bool,
homeTarget:
homeTarget == const $CopyWithPlaceholder() || homeTarget == null
? _value.homeTarget
// ignore: cast_nullable_to_non_nullable
: homeTarget as HomeTarget,
homeTargetUrl: homeTargetUrl == const $CopyWithPlaceholder()
? _value.homeTargetUrl
// ignore: cast_nullable_to_non_nullable
: homeTargetUrl as String?,
homeTargetOnLastTabClosed:
homeTargetOnLastTabClosed == const $CopyWithPlaceholder() ||
homeTargetOnLastTabClosed == null
? _value.homeTargetOnLastTabClosed
// ignore: cast_nullable_to_non_nullable
: homeTargetOnLastTabClosed as bool,
storedDefaultCreateTabType:
storedDefaultCreateTabType == const $CopyWithPlaceholder() ||
storedDefaultCreateTabType == null
@@ -1095,6 +1134,9 @@ GeneralSettings _$GeneralSettingsFromJson(
showContainerUi: json['showContainerUi'] as bool?,
showIsolatedTabUi: json['showIsolatedTabUi'] as bool?,
showSearchCloseButton: json['showSearchCloseButton'] as bool?,
homeTarget: $enumDecodeNullable(_$HomeTargetEnumMap, json['homeTarget']),
homeTargetUrl: json['homeTargetUrl'] as String?,
homeTargetOnLastTabClosed: json['homeTargetOnLastTabClosed'] as bool?,
storedDefaultCreateTabType: $enumDecodeNullable(
_$TabTypeEnumMap,
json['defaultCreateTabType'],
@@ -1234,6 +1276,9 @@ Map<String, dynamic> _$GeneralSettingsToJson(
'showContainerUi': instance.showContainerUi,
'showIsolatedTabUi': instance.showIsolatedTabUi,
'showSearchCloseButton': instance.showSearchCloseButton,
'homeTarget': _$HomeTargetEnumMap[instance.homeTarget]!,
'homeTargetUrl': instance.homeTargetUrl,
'homeTargetOnLastTabClosed': instance.homeTargetOnLastTabClosed,
'defaultCreateTabType':
_$TabTypeEnumMap[instance.storedDefaultCreateTabType]!,
'tabListDirection': _$TabDirectionEnumMap[instance.tabListDirection]!,
@@ -1331,6 +1376,12 @@ const _$SearchSuggestionProvidersEnumMap = {
SearchSuggestionProviders.qwant: 'qwant',
};
const _$HomeTargetEnumMap = {
HomeTarget.home: 'home',
HomeTarget.resumeLastTab: 'resumeLastTab',
HomeTarget.customUrl: 'customUrl',
};
const _$TabTypeEnumMap = {
TabType.regular: 'regular',
TabType.private: 'private',