mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-30 15:58:51 +02:00
fix(navigation): open download queue from snackbar actions
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user