spotube/lib/pages/stats/playlists/playlists.dart
Kingkor Roy Tirtho 82307bc030
feat: personalized stats based on local music history (#1522)
* feat: add playback history provider

* feat: implement recently played section

* refactor: use route names

* feat: add stats summary and top tracks/artists/albums

* feat: add top date based filtering

* feat: add stream money calculation

* refactor: place search in mobile navbar and settings in home appbar

* feat: add individual minutes and streams page

* feat(stats): add individual minutes and streams page

* chore: default period to 1 month

* feat: add text to explain user how hypothetical fees are calculated

* chore: ensure usage of route names instead of direct paths

* cd: add cache key

* cd: remove media_kit_event_loop from git
2024-06-01 11:40:01 +06:00

40 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/collections/formatters.dart';
import 'package:spotube/components/shared/page_window_title_bar.dart';
import 'package:spotube/components/stats/common/playlist_item.dart';
import 'package:spotube/provider/history/state.dart';
import 'package:spotube/provider/history/top.dart';
class StatsPlaylistsPage extends HookConsumerWidget {
static const name = "stats_playlists";
const StatsPlaylistsPage({super.key});
@override
Widget build(BuildContext context, ref) {
final playlists = ref.watch(
playbackHistoryTopProvider(HistoryDuration.allTime)
.select((s) => s.playlists),
);
return Scaffold(
appBar: const PageWindowTitleBar(
automaticallyImplyLeading: true,
centerTitle: false,
title: Text("Playlists"),
),
body: ListView.builder(
itemCount: playlists.length,
itemBuilder: (context, index) {
final playlist = playlists[index];
return StatsPlaylistItem(
playlist: playlist.playlist.playlist,
info:
Text("${compactNumberFormatter.format(playlist.count)} plays"),
);
},
),
);
}
}