improve tab (and other lexorank entities) sorting, ordering and reordering

This commit is contained in:
Fabian Freund
2026-05-02 04:50:53 +02:00
parent 222b920a47
commit 69f21bb7d8
43 changed files with 4965 additions and 418 deletions
@@ -69,7 +69,8 @@ class _TabsSection extends StatelessWidget {
SettingSection(name: 'Tabs'),
_NewTabDefaultSection(),
_SmallWebTabDefaultSection(),
_NewTabPositionSection(),
_TabListDirectionSection(),
_TabBarDirectionSection(),
_ShowContainerUiTile(),
_ShowIsolatedTabUiTile(),
_CreateChildTabsTile(),
@@ -340,13 +341,13 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
}
}
class _NewTabPositionSection extends HookConsumerWidget {
const _NewTabPositionSection();
class _TabListDirectionSection extends HookConsumerWidget {
const _TabListDirectionSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final newTabPosition = ref.watch(
generalSettingsWithDefaultsProvider.select((s) => s.newTabPosition),
final direction = ref.watch(
generalSettingsWithDefaultsProvider.select((s) => s.tabListDirection),
);
return Padding(
@@ -356,8 +357,65 @@ class _NewTabPositionSection extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const ListTile(
title: Text('New Tab Position'),
subtitle: Text('Choose where newly created tabs appear by default'),
title: Text('Tab List Direction'),
subtitle: Text(
'Choose whether the newest tab appears at the top or bottom of the tab list',
),
leading: Icon(MdiIcons.formatListBulleted),
contentPadding: EdgeInsets.zero,
),
Center(
child: SegmentedButton(
showSelectedIcon: false,
segments: const [
ButtonSegment(
value: TabListDirection.newestFirst,
label: Text('Newest first'),
icon: Icon(MdiIcons.arrowCollapseUp),
),
ButtonSegment(
value: TabListDirection.oldestFirst,
label: Text('Oldest first'),
icon: Icon(MdiIcons.arrowCollapseDown),
),
],
selected: {direction},
onSelectionChanged: (value) async {
await ref
.read(saveGeneralSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.tabListDirection(value.first),
);
},
),
),
],
),
);
}
}
class _TabBarDirectionSection extends HookConsumerWidget {
const _TabBarDirectionSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final direction = ref.watch(
generalSettingsWithDefaultsProvider.select((s) => s.tabBarDirection),
);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const ListTile(
title: Text('Tab Bar Direction'),
subtitle: Text(
'Choose whether the newest tab appears on the left or right of the quick switcher',
),
leading: Icon(MdiIcons.reorderHorizontal),
contentPadding: EdgeInsets.zero,
),
@@ -366,23 +424,23 @@ class _NewTabPositionSection extends HookConsumerWidget {
showSelectedIcon: false,
segments: const [
ButtonSegment(
value: NewTabPosition.first,
label: Text('First'),
value: TabBarDirection.newestFirst,
label: Text('Newest first'),
icon: Icon(MdiIcons.arrowCollapseLeft),
),
ButtonSegment(
value: NewTabPosition.end,
label: Text('End'),
value: TabBarDirection.oldestFirst,
label: Text('Oldest first'),
icon: Icon(MdiIcons.arrowCollapseRight),
),
],
selected: {newTabPosition},
selected: {direction},
onSelectionChanged: (value) async {
await ref
.read(saveGeneralSettingsControllerProvider.notifier)
.save(
(currentSettings) =>
currentSettings.copyWith.newTabPosition(value.first),
currentSettings.copyWith.tabBarDirection(value.first),
);
},
),