add setting to control tab insertion position

This commit is contained in:
Fabian Freund
2026-03-13 05:07:48 +01:00
parent 8dc7151c45
commit 8a07d7df1a
10 changed files with 132 additions and 10 deletions
@@ -68,6 +68,7 @@ class _TabCreationSection extends StatelessWidget {
children: [
SettingSection(name: 'Tab Creation'),
_NewTabDefaultSection(),
_NewTabPositionSection(),
_ExternalLinkHandlingSection(),
_AppLinksModeSection(),
],
@@ -255,6 +256,59 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
}
}
class _NewTabPositionSection extends HookConsumerWidget {
const _NewTabPositionSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final newTabPosition = ref.watch(
generalSettingsWithDefaultsProvider.select((s) => s.newTabPosition),
);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const ListTile(
title: Text('New Tab Position'),
subtitle: Text('Choose where newly created tabs appear by default'),
leading: Icon(MdiIcons.reorderHorizontal),
contentPadding: EdgeInsets.zero,
),
Center(
child: SegmentedButton(
showSelectedIcon: false,
segments: const [
ButtonSegment(
value: NewTabPosition.first,
label: Text('First'),
icon: Icon(MdiIcons.arrowCollapseLeft),
),
ButtonSegment(
value: NewTabPosition.end,
label: Text('End'),
icon: Icon(MdiIcons.arrowCollapseRight),
),
],
selected: {newTabPosition},
onSelectionChanged: (value) async {
await ref
.read(saveGeneralSettingsControllerProvider.notifier)
.save(
(currentSettings) =>
currentSettings.copyWith.newTabPosition(value.first),
);
},
),
),
],
),
);
}
}
class _CreateChildTabsTile extends HookConsumerWidget {
const _CreateChildTabsTile();