add setting to control tab insertion position
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user