bookmar default open setting

This commit is contained in:
Fabian Freund
2026-07-31 05:46:26 +02:00
parent bdfc851681
commit 22c2b15de6
9 changed files with 250 additions and 18 deletions
@@ -89,6 +89,11 @@ enum TabBarStackingMode {
enum TabIntentOpenSetting { regular, private, isolated, ask }
/// Determines what happens when a bookmark is tapped in the bookmark list.
/// [ask] shows the "open in..." sheet (today's behavior, and the default);
/// the other values open the bookmark directly with no intermediate prompt.
enum BookmarkOpenSetting { regular, isolated, customTab, ask }
enum TabDirection { newestFirst, oldestFirst }
enum TabBarPosition {
@@ -157,6 +162,10 @@ class GeneralSettings with FastEquatable {
final TabDirection tabListDirection;
final TabDirection tabBarDirection;
final TabIntentOpenSetting tabIntentOpenSetting;
/// Determines what happens when a bookmark is tapped. See
/// [BookmarkOpenSetting] and [effectiveBookmarkOpenSetting].
final BookmarkOpenSetting bookmarkOpenSetting;
final bool autoHideTabBar;
final TabBarSwipeAction tabBarSwipeAction;
final Duration historyAutoCleanInterval;
@@ -286,6 +295,7 @@ class GeneralSettings with FastEquatable {
required this.tabListDirection,
required this.tabBarDirection,
required this.tabIntentOpenSetting,
required this.bookmarkOpenSetting,
required this.autoHideTabBar,
required this.tabBarSwipeAction,
required this.historyAutoCleanInterval,
@@ -358,6 +368,7 @@ class GeneralSettings with FastEquatable {
TabDirection? tabListDirection,
TabDirection? tabBarDirection,
TabIntentOpenSetting? tabIntentOpenSetting,
BookmarkOpenSetting? bookmarkOpenSetting,
bool? autoHideTabBar,
TabBarSwipeAction? tabBarSwipeAction,
Duration? historyAutoCleanInterval,
@@ -428,6 +439,7 @@ class GeneralSettings with FastEquatable {
tabListDirection = tabListDirection ?? TabDirection.newestFirst,
tabBarDirection = tabBarDirection ?? TabDirection.newestFirst,
tabIntentOpenSetting = tabIntentOpenSetting ?? TabIntentOpenSetting.ask,
bookmarkOpenSetting = bookmarkOpenSetting ?? BookmarkOpenSetting.ask,
autoHideTabBar = autoHideTabBar ?? true,
tabBarSwipeAction =
tabBarSwipeAction ?? TabBarSwipeAction.switchLastOpened,
@@ -550,6 +562,14 @@ class GeneralSettings with FastEquatable {
return tabIntentOpenSetting;
}
BookmarkOpenSetting get effectiveBookmarkOpenSetting {
if (!showIsolatedTabUi &&
bookmarkOpenSetting == BookmarkOpenSetting.isolated) {
return BookmarkOpenSetting.ask;
}
return bookmarkOpenSetting;
}
/// Container-dependent stacking modes degrade to a single recently-used
/// row when the container UI is disabled. Two-level stacking additionally
/// degrades to accordion (the default mode, which has a vertical form) on the
@@ -595,6 +615,7 @@ class GeneralSettings with FastEquatable {
tabListDirection,
tabBarDirection,
tabIntentOpenSetting,
bookmarkOpenSetting,
autoHideTabBar,
tabBarSwipeAction,
historyAutoCleanInterval,
@@ -55,6 +55,8 @@ abstract class _$GeneralSettingsCWProxy {
TabIntentOpenSetting tabIntentOpenSetting,
);
GeneralSettings bookmarkOpenSetting(BookmarkOpenSetting bookmarkOpenSetting);
GeneralSettings autoHideTabBar(bool autoHideTabBar);
GeneralSettings tabBarSwipeAction(TabBarSwipeAction tabBarSwipeAction);
@@ -195,6 +197,7 @@ abstract class _$GeneralSettingsCWProxy {
TabDirection tabListDirection,
TabDirection tabBarDirection,
TabIntentOpenSetting tabIntentOpenSetting,
BookmarkOpenSetting bookmarkOpenSetting,
bool autoHideTabBar,
TabBarSwipeAction tabBarSwipeAction,
Duration historyAutoCleanInterval,
@@ -338,6 +341,11 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
TabIntentOpenSetting tabIntentOpenSetting,
) => call(tabIntentOpenSetting: tabIntentOpenSetting);
@override
GeneralSettings bookmarkOpenSetting(
BookmarkOpenSetting bookmarkOpenSetting,
) => call(bookmarkOpenSetting: bookmarkOpenSetting);
@override
GeneralSettings autoHideTabBar(bool autoHideTabBar) =>
call(autoHideTabBar: autoHideTabBar);
@@ -578,6 +586,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
Object? tabListDirection = const $CopyWithPlaceholder(),
Object? tabBarDirection = const $CopyWithPlaceholder(),
Object? tabIntentOpenSetting = const $CopyWithPlaceholder(),
Object? bookmarkOpenSetting = const $CopyWithPlaceholder(),
Object? autoHideTabBar = const $CopyWithPlaceholder(),
Object? tabBarSwipeAction = const $CopyWithPlaceholder(),
Object? historyAutoCleanInterval = const $CopyWithPlaceholder(),
@@ -746,6 +755,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
? _value.tabIntentOpenSetting
// ignore: cast_nullable_to_non_nullable
: tabIntentOpenSetting as TabIntentOpenSetting,
bookmarkOpenSetting:
bookmarkOpenSetting == const $CopyWithPlaceholder() ||
bookmarkOpenSetting == null
? _value.bookmarkOpenSetting
// ignore: cast_nullable_to_non_nullable
: bookmarkOpenSetting as BookmarkOpenSetting,
autoHideTabBar:
autoHideTabBar == const $CopyWithPlaceholder() ||
autoHideTabBar == null
@@ -1096,6 +1111,10 @@ GeneralSettings _$GeneralSettingsFromJson(
_$TabIntentOpenSettingEnumMap,
json['tabIntentOpenSetting'],
),
bookmarkOpenSetting: $enumDecodeNullable(
_$BookmarkOpenSettingEnumMap,
json['bookmarkOpenSetting'],
),
autoHideTabBar: json['autoHideTabBar'] as bool?,
tabBarSwipeAction: $enumDecodeNullable(
_$TabBarSwipeActionEnumMap,
@@ -1221,6 +1240,8 @@ Map<String, dynamic> _$GeneralSettingsToJson(
'tabBarDirection': _$TabDirectionEnumMap[instance.tabBarDirection]!,
'tabIntentOpenSetting':
_$TabIntentOpenSettingEnumMap[instance.tabIntentOpenSetting]!,
'bookmarkOpenSetting':
_$BookmarkOpenSettingEnumMap[instance.bookmarkOpenSetting]!,
'autoHideTabBar': instance.autoHideTabBar,
'tabBarSwipeAction': _$TabBarSwipeActionEnumMap[instance.tabBarSwipeAction]!,
'historyAutoCleanInterval': instance.historyAutoCleanInterval.inMicroseconds,
@@ -1329,6 +1350,13 @@ const _$TabIntentOpenSettingEnumMap = {
TabIntentOpenSetting.ask: 'ask',
};
const _$BookmarkOpenSettingEnumMap = {
BookmarkOpenSetting.regular: 'regular',
BookmarkOpenSetting.isolated: 'isolated',
BookmarkOpenSetting.customTab: 'customTab',
BookmarkOpenSetting.ask: 'ask',
};
const _$TabBarSwipeActionEnumMap = {
TabBarSwipeAction.switchLastOpened: 'switchLastOpened',
TabBarSwipeAction.navigateOrderedTabs: 'navigateOrderedTabs',