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
@@ -1,5 +1,7 @@
import 'package:flutter/widgets.dart';
enum ShellTab { home, library, repository, settings }
class ShellNavigationService {
static final GlobalKey<NavigatorState> homeTabNavigatorKey =
GlobalKey<NavigatorState>();
@@ -10,6 +12,29 @@ class ShellNavigationService {
static int _currentTabIndex = 0;
static bool _showRepoTab = false;
static Object? _tabSelectionOwner;
static ValueChanged<ShellTab>? _tabSelectionHandler;
static void registerTabSelectionHandler({
required Object owner,
required ValueChanged<ShellTab> handler,
}) {
_tabSelectionOwner = owner;
_tabSelectionHandler = handler;
}
static void unregisterTabSelectionHandler(Object owner) {
if (!identical(_tabSelectionOwner, owner)) return;
_tabSelectionOwner = null;
_tabSelectionHandler = null;
}
static bool requestTab(ShellTab tab) {
final handler = _tabSelectionHandler;
if (handler == null) return false;
handler(tab);
return true;
}
static void syncState({
required int currentTabIndex,