fix(navigation): open download queue from snackbar actions

This commit is contained in:
zarzet
2026-07-24 22:19:03 +07:00
parent 01c08322c1
commit eabafecaeb
6 changed files with 150 additions and 12 deletions
+18
View File
@@ -105,6 +105,10 @@ class _MainShellState extends ConsumerState<MainShell>
duration: const Duration(milliseconds: 180),
value: 1,
);
ShellNavigationService.registerTabSelectionHandler(
owner: this,
handler: _onShellTabRequested,
);
ShellNavigationService.syncState(
currentTabIndex: _currentIndex,
showRepoTab: false,
@@ -433,6 +437,7 @@ class _MainShellState extends ConsumerState<MainShell>
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
ShellNavigationService.unregisterTabSelectionHandler(this);
_shareSubscription?.cancel();
_pageController.dispose();
_tabJumpTransitionController.dispose();
@@ -452,6 +457,19 @@ class _MainShellState extends ConsumerState<MainShell>
ref.read(trackProvider.notifier).clear();
}
void _onShellTabRequested(ShellTab tab) {
final showStore = ref.read(
settingsProvider.select((s) => s.showExtensionStore),
);
final index = switch (tab) {
ShellTab.home => 0,
ShellTab.library => 1,
ShellTab.repository => showStore ? 2 : null,
ShellTab.settings => showStore ? 3 : 2,
};
if (index != null) _onNavTap(index);
}
void _onNavTap(int index) {
if (index == 0 && _currentIndex == 0) {
_resetHomeToMain();