mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-02 09:08:35 +02:00
fix(queue): give completion-bridge cells swipe navigation into the library list
This commit is contained in:
@@ -149,8 +149,10 @@ extension _QueueTabCollectionItemWidgets on _QueueTabState {
|
||||
BuildContext context,
|
||||
DownloadItem item,
|
||||
ColorScheme colorScheme,
|
||||
DownloadHistoryItem? historyItem,
|
||||
) {
|
||||
DownloadHistoryItem? historyItem, {
|
||||
List<DownloadHistoryItem>? navigationItems,
|
||||
int? navigationIndex,
|
||||
}) {
|
||||
final track = item.track;
|
||||
final radius = BorderRadius.circular(8);
|
||||
final unifiedItem = historyItem == null
|
||||
@@ -178,7 +180,11 @@ extension _QueueTabCollectionItemWidgets on _QueueTabState {
|
||||
label: context.l10n.a11yTrackByArtist(trackName, artistName),
|
||||
child: GestureDetector(
|
||||
onTap: () => historyItem != null
|
||||
? _navigateToHistoryMetadataScreen(historyItem)
|
||||
? _navigateToHistoryMetadataScreen(
|
||||
historyItem,
|
||||
navigationItems: navigationItems,
|
||||
navigationIndex: navigationIndex,
|
||||
)
|
||||
: _navigateToMetadataScreen(item),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -232,8 +238,10 @@ extension _QueueTabCollectionItemWidgets on _QueueTabState {
|
||||
BuildContext context,
|
||||
DownloadItem item,
|
||||
ColorScheme colorScheme,
|
||||
DownloadHistoryItem? historyItem,
|
||||
) {
|
||||
DownloadHistoryItem? historyItem, {
|
||||
List<DownloadHistoryItem>? navigationItems,
|
||||
int? navigationIndex,
|
||||
}) {
|
||||
final track = item.track;
|
||||
final coverSize = _queueCoverSize();
|
||||
final radius = BorderRadius.circular(8);
|
||||
@@ -269,7 +277,11 @@ extension _QueueTabCollectionItemWidgets on _QueueTabState {
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
onTap: () => historyItem != null
|
||||
? _navigateToHistoryMetadataScreen(historyItem)
|
||||
? _navigateToHistoryMetadataScreen(
|
||||
historyItem,
|
||||
navigationItems: navigationItems,
|
||||
navigationIndex: navigationIndex,
|
||||
)
|
||||
: _navigateToMetadataScreen(item),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
||||
@@ -173,6 +173,27 @@ extension _QueueTabFilterWidgets on _QueueTabState {
|
||||
}
|
||||
}
|
||||
|
||||
// Completion-bridge tracks are hidden from filteredUnifiedItems, so weave
|
||||
// them into the front of the swipe-navigation list (matching their pinned
|
||||
// lead-zone position) — otherwise a just-downloaded track opens with no
|
||||
// swipe navigation at all until its row lands in the library query.
|
||||
final bridgeNavigationIndexById = <String, int>{};
|
||||
if (bridgeIds.isNotEmpty) {
|
||||
final bridgeHistoryItems = <DownloadHistoryItem>[];
|
||||
for (final id in bridgeIds) {
|
||||
final historyItem = bridgeHistoryById[id];
|
||||
if (historyItem == null) continue;
|
||||
bridgeNavigationIndexById[id] = bridgeHistoryItems.length;
|
||||
bridgeHistoryItems.add(historyItem);
|
||||
}
|
||||
if (bridgeHistoryItems.isNotEmpty) {
|
||||
downloadedNavigationItems.insertAll(0, bridgeHistoryItems);
|
||||
downloadedNavigationIndexByUnifiedId.updateAll(
|
||||
(_, index) => index + bridgeHistoryItems.length,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final leadCount = activeDownloadIds.length + bridgeIds.length;
|
||||
final collectionEntries = filterMode == 'all'
|
||||
? _getVisibleCollectionEntries(collectionState)
|
||||
@@ -197,6 +218,8 @@ extension _QueueTabFilterWidgets on _QueueTabState {
|
||||
_completionBridge[bridgeId]!,
|
||||
colorScheme,
|
||||
bridgeHistoryById[bridgeId],
|
||||
navigationItems: downloadedNavigationItems,
|
||||
navigationIndex: bridgeNavigationIndexById[bridgeId],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -219,6 +242,8 @@ extension _QueueTabFilterWidgets on _QueueTabState {
|
||||
_completionBridge[bridgeId]!,
|
||||
colorScheme,
|
||||
bridgeHistoryById[bridgeId],
|
||||
navigationItems: downloadedNavigationItems,
|
||||
navigationIndex: bridgeNavigationIndexById[bridgeId],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user