feat(flutter): library screen with 5 tabs (Artists/Albums/History/Liked/Hidden)
Models: - history_event.dart (HistoryEvent + HistoryPage envelope) - quarantine_mine.dart (QuarantineMineRow for /api/quarantine/mine) - Renamed Page<T> -> Paged<T> to avoid collision with Material's Page Endpoints: - library_lists.dart: listArtists / listAlbums (paged) - me.dart: history + quarantineMine - likes.dart: extended with listTracks/Albums/Artists (paged) UI: - library_screen.dart: TabBar over 5 tabs - Artists tab: 3-col grid - Albums tab: 2-col grid - History tab: list with relative-time formatting (matches HistoryRow.svelte) - Liked tab: 3 stacked sections (artists scroll-row, albums scroll-row, tracks list) - Hidden tab: list of quarantined tracks with reason pill - /library route + library_music icon on home AppBar First page only for v1 (limit 50). Infinite scroll deferred.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// Mirrors the server's Page<T> envelope used by paged endpoints
|
||||
// Mirrors the server's Page[T] envelope used by paged endpoints
|
||||
// (/api/search, /api/library/artists, /api/library/albums,
|
||||
// /api/library/history, /api/me/likes/*).
|
||||
// /api/likes/*). Class is named `Paged<T>` rather than `Page<T>`
|
||||
// to avoid ambiguous imports with Flutter Material's Navigator-2.0
|
||||
// `Page` class.
|
||||
//
|
||||
// Wire shape from internal/api/types.go Page[T]:
|
||||
// { items: T[], total: int, limit: int, offset: int }
|
||||
@@ -8,8 +10,8 @@
|
||||
// Dart generics can't auto-infer T from JSON, so callers pass an
|
||||
// itemFromJson function alongside the raw map. Parse logic stays in
|
||||
// each entity's own fromJson; this class only handles the envelope.
|
||||
class Page<T> {
|
||||
const Page({
|
||||
class Paged<T> {
|
||||
const Paged({
|
||||
required this.items,
|
||||
required this.total,
|
||||
required this.limit,
|
||||
@@ -21,12 +23,12 @@ class Page<T> {
|
||||
final int limit;
|
||||
final int offset;
|
||||
|
||||
factory Page.fromJson(
|
||||
factory Paged.fromJson(
|
||||
Map<String, dynamic> j,
|
||||
T Function(Map<String, dynamic>) itemFromJson,
|
||||
) {
|
||||
final raw = (j['items'] as List?) ?? const [];
|
||||
return Page<T>(
|
||||
return Paged<T>(
|
||||
items: raw
|
||||
.map((e) => itemFromJson((e as Map).cast<String, dynamic>()))
|
||||
.toList(growable: false),
|
||||
|
||||
Reference in New Issue
Block a user