isolated tab type default handling

This commit is contained in:
Fabian Freund
2026-05-02 06:20:11 +02:00
parent e4853281f1
commit 94b9b9cceb
7 changed files with 66 additions and 26 deletions
@@ -198,7 +198,7 @@ class _SmallWebTabDefaultSection extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final appColors = AppColors.of(context);
final settings = ref.watch(generalSettingsWithDefaultsProvider);
final smallWebTabType = settings.smallWebTabType;
final smallWebTabType = settings.effectiveSmallWebTabType;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
@@ -276,9 +276,8 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final appColors = AppColors.of(context);
final tabIntentOpenSetting = ref.watch(
generalSettingsWithDefaultsProvider.select((s) => s.tabIntentOpenSetting),
);
final settings = ref.watch(generalSettingsWithDefaultsProvider);
final tabIntentOpenSetting = settings.tabIntentOpenSetting;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
@@ -316,6 +315,18 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
: appColors.privateTabPurple,
),
),
if (settings.showIsolatedTabUi)
ButtonSegment(
value: TabIntentOpenSetting.isolated,
label: const Text('Isolated'),
icon: Icon(
MdiIcons.snowflake,
color:
tabIntentOpenSetting == TabIntentOpenSetting.isolated
? null
: appColors.isolatedTabTeal,
),
),
],
selected: {tabIntentOpenSetting},
onSelectionChanged: (value) async {
@@ -331,6 +342,9 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
TabIntentOpenSetting.private => SegmentedButton.styleFrom(
selectedBackgroundColor: appColors.privateSelectionOverlay,
),
TabIntentOpenSetting.isolated => SegmentedButton.styleFrom(
selectedBackgroundColor: appColors.isolatedSelectionOverlay,
),
TabIntentOpenSetting.ask => null,
},
),
@@ -546,6 +560,15 @@ class _ShowIsolatedTabUiTile extends HookConsumerWidget {
TabType.regular,
);
}
if (!value &&
updated.tabIntentOpenSetting == TabIntentOpenSetting.isolated) {
updated = updated.copyWith.tabIntentOpenSetting(
TabIntentOpenSetting.ask,
);
}
if (!value && updated.smallWebTabType == TabType.isolated) {
updated = updated.copyWith.smallWebTabType(TabType.private);
}
return updated;
});
},