always show MRU-first regardless of tabBarDirection
This commit is contained in:
@@ -342,14 +342,6 @@ EquatableValue<List<TabStateWithContainer>> quickTabSwitcherTabStates(
|
|||||||
ref.watch(selectedContainerTabStatesWithContainerProvider).value,
|
ref.watch(selectedContainerTabStatesWithContainerProvider).value,
|
||||||
};
|
};
|
||||||
|
|
||||||
// `containerTabs` already had `tabBarDirection` applied during its sort.
|
|
||||||
// For `lastUsedTabs` the upstream `fifoTabStates` is MRU-first (timestamp
|
|
||||||
// desc); honour the same direction setting here so the user's choice
|
|
||||||
// takes effect in the default switcher mode too.
|
|
||||||
final tabBarDirection = ref.watch(
|
|
||||||
generalSettingsWithDefaultsProvider.select((s) => s.tabBarDirection),
|
|
||||||
);
|
|
||||||
|
|
||||||
final pinnedTabIds = ref.watch(
|
final pinnedTabIds = ref.watch(
|
||||||
watchPinnedTabIdsProvider.select(
|
watchPinnedTabIdsProvider.select(
|
||||||
(value) => value.value ?? const <String>{},
|
(value) => value.value ?? const <String>{},
|
||||||
@@ -364,6 +356,7 @@ EquatableValue<List<TabStateWithContainer>> quickTabSwitcherTabStates(
|
|||||||
final filtered = tabStates
|
final filtered = tabStates
|
||||||
.where((state) => state.$1.id != selectedTabId)
|
.where((state) => state.$1.id != selectedTabId)
|
||||||
.toList();
|
.toList();
|
||||||
|
// Always show MRU-first regardless of tabBarDirection.
|
||||||
if (sortPinnedFirst && pinnedTabIds.isNotEmpty) {
|
if (sortPinnedFirst && pinnedTabIds.isNotEmpty) {
|
||||||
final pinned = filtered
|
final pinned = filtered
|
||||||
.where((s) => pinnedTabIds.contains(s.$1.id))
|
.where((s) => pinnedTabIds.contains(s.$1.id))
|
||||||
@@ -371,16 +364,9 @@ EquatableValue<List<TabStateWithContainer>> quickTabSwitcherTabStates(
|
|||||||
final unpinned = filtered
|
final unpinned = filtered
|
||||||
.where((s) => !pinnedTabIds.contains(s.$1.id))
|
.where((s) => !pinnedTabIds.contains(s.$1.id))
|
||||||
.toList();
|
.toList();
|
||||||
// Each partition is MRU-first from fifoTabStates. For oldestFirst,
|
|
||||||
// reverse each partition independently so pinned stays on top.
|
|
||||||
if (tabBarDirection == TabDirection.oldestFirst) {
|
|
||||||
return [...pinned.reversed, ...unpinned.reversed];
|
|
||||||
}
|
|
||||||
return [...pinned, ...unpinned];
|
return [...pinned, ...unpinned];
|
||||||
}
|
}
|
||||||
return tabBarDirection == TabDirection.oldestFirst
|
return filtered;
|
||||||
? filtered.reversed.toList()
|
|
||||||
: filtered;
|
|
||||||
}(),
|
}(),
|
||||||
QuickTabSwitcherMode.containerTabs => tabStates,
|
QuickTabSwitcherMode.containerTabs => tabStates,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -601,7 +601,7 @@ final class QuickTabSwitcherTabStatesProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$quickTabSwitcherTabStatesHash() =>
|
String _$quickTabSwitcherTabStatesHash() =>
|
||||||
r'3a1a195f6b2fc4cc54e689fab7bacaf4e6422196';
|
r'213c9c492055175de8fc684e0c9fb9a3530fbb6f';
|
||||||
|
|
||||||
final class QuickTabSwitcherTabStatesFamily extends $Family
|
final class QuickTabSwitcherTabStatesFamily extends $Family
|
||||||
with
|
with
|
||||||
|
|||||||
Reference in New Issue
Block a user