mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-21 15:02:21 +02:00
refactor(library): drop unread QueueTab page parameters and fast-scroller callbacks
Nothing read parentPageController, parentPageIndex or nextPageIndex, and the Library tab root watched showExtensionStore only to compute them, so toggling that setting rebuilt the tab for nothing. No caller passed the fast scroller onDragStart/onDragEnd callbacks.
This commit is contained in:
1 parent
68c739dfa1
commit
0810ee7847
3 files changed
+4
-40
No files matched your search
@@ -819,10 +819,7 @@ class _MainShellState extends ConsumerState<MainShell>
|
||||
navigatorKey: _libraryTabNavigatorKey,
|
||||
observers: [_libraryPreviewStopObserver],
|
||||
heroAnimationsEnabled: heroAnimationsEnabled,
|
||||
child: _LibraryTabRoot(
|
||||
parentPageController: _pageController,
|
||||
isTabActive: _currentIndex == 1,
|
||||
),
|
||||
child: _LibraryTabRoot(isTabActive: _currentIndex == 1),
|
||||
),
|
||||
if (showStore)
|
||||
_TabNavigator(
|
||||
@@ -1224,25 +1221,13 @@ class _PreviewStopNavigatorObserver extends NavigatorObserver {
|
||||
}
|
||||
|
||||
class _LibraryTabRoot extends ConsumerWidget {
|
||||
final PageController parentPageController;
|
||||
final bool isTabActive;
|
||||
|
||||
const _LibraryTabRoot({
|
||||
required this.parentPageController,
|
||||
required this.isTabActive,
|
||||
});
|
||||
const _LibraryTabRoot({required this.isTabActive});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final showStore = ref.watch(
|
||||
settingsProvider.select((s) => s.showExtensionStore),
|
||||
);
|
||||
return QueueTab(
|
||||
isTabActive: isTabActive,
|
||||
parentPageController: parentPageController,
|
||||
parentPageIndex: 1,
|
||||
nextPageIndex: showStore ? 2 : 3,
|
||||
);
|
||||
return QueueTab(isTabActive: isTabActive);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -239,18 +239,8 @@ DownloadHistoryItem? _historyItemForCompletionBridge(
|
||||
class QueueTab extends ConsumerStatefulWidget {
|
||||
final String? librarySection;
|
||||
final bool isTabActive;
|
||||
final PageController? parentPageController;
|
||||
final int parentPageIndex;
|
||||
final int? nextPageIndex;
|
||||
|
||||
const QueueTab({
|
||||
super.key,
|
||||
this.librarySection,
|
||||
this.isTabActive = true,
|
||||
this.parentPageController,
|
||||
this.parentPageIndex = 1,
|
||||
this.nextPageIndex,
|
||||
});
|
||||
const QueueTab({super.key, this.librarySection, this.isTabActive = true});
|
||||
|
||||
@override
|
||||
ConsumerState<QueueTab> createState() => _QueueTabState();
|
||||
|
||||
@@ -19,8 +19,6 @@ class LibraryFastScroller extends StatefulWidget {
|
||||
super.key,
|
||||
required this.child,
|
||||
required this.labelAt,
|
||||
this.onDragStart,
|
||||
this.onDragEnd,
|
||||
this.topPadding = 0,
|
||||
this.bottomPadding = 0,
|
||||
});
|
||||
@@ -32,9 +30,6 @@ class LibraryFastScroller extends StatefulWidget {
|
||||
/// Label for the row at [fraction] of the scrollable content, or null.
|
||||
final String? Function(double fraction) labelAt;
|
||||
|
||||
final VoidCallback? onDragStart;
|
||||
final VoidCallback? onDragEnd;
|
||||
|
||||
/// Height of the pinned header. While an outer scroll view is expanded,
|
||||
/// only its overlap with this viewport is reserved.
|
||||
final double topPadding;
|
||||
@@ -86,10 +81,6 @@ class _LibraryFastScrollerState extends State<LibraryFastScroller> {
|
||||
_hideTimer?.cancel();
|
||||
_position?.removeListener(_onPositionChanged);
|
||||
_outerPosition?.removeListener(_onOuterPositionChanged);
|
||||
if (_dragging) {
|
||||
final onDragEnd = widget.onDragEnd;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => onDragEnd?.call());
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -155,7 +146,6 @@ class _LibraryFastScrollerState extends State<LibraryFastScroller> {
|
||||
_dragging = true;
|
||||
_show();
|
||||
});
|
||||
widget.onDragStart?.call();
|
||||
}
|
||||
|
||||
void _updateDrag(DragUpdateDetails details, double trackHeight) {
|
||||
@@ -197,7 +187,6 @@ class _LibraryFastScrollerState extends State<LibraryFastScroller> {
|
||||
_dragging = false;
|
||||
_show();
|
||||
});
|
||||
widget.onDragEnd?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in new issue
Block a user