mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-20 22:41:38 +02:00
Search bucketing, refresh policy, folder data, history snapshot and the selection and collapsing-header mixins hold no widgets, so they move to controllers; the settings search catalog is pure presentation metadata and moves to utils. Files with many importers keep a re-export in screens.
23 lines
969 B
Dart
23 lines
969 B
Dart
import 'package:spotiflac_android/models/track.dart';
|
|
import 'package:spotiflac_android/controllers/track_history_snapshot.dart';
|
|
import 'package:spotiflac_android/providers/library_collections_provider.dart';
|
|
import 'package:spotiflac_android/services/history_database.dart';
|
|
|
|
/// Collection providers replace their track list when its contents change.
|
|
/// Keep derived data across selection/layout rebuilds of the same snapshot.
|
|
class LibraryTracksFolderData {
|
|
List<CollectionTrackEntry>? _entries;
|
|
Set<String> keys = const {};
|
|
List<Track> tracks = const [];
|
|
final _history = TrackHistorySnapshot();
|
|
HistoryBatchLookupRequest get historyRequest => _history.request;
|
|
|
|
void update(List<CollectionTrackEntry> entries) {
|
|
if (identical(entries, _entries)) return;
|
|
_entries = entries;
|
|
keys = Set.unmodifiable(entries.map((entry) => entry.key));
|
|
tracks = List.unmodifiable(entries.map((entry) => entry.track));
|
|
_history.update(tracks);
|
|
}
|
|
}
|