mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00

* 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
45 lines
1.3 KiB
Dart
45 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:gap/gap.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/track_item.dart';
|
|
import 'package:spotube/provider/history/state.dart';
|
|
import 'package:spotube/provider/history/top.dart';
|
|
|
|
class StatsStreamsPage extends HookConsumerWidget {
|
|
static const name = "stats_streams";
|
|
|
|
const StatsStreamsPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final topTracks = ref.watch(
|
|
playbackHistoryTopProvider(HistoryDuration.allTime)
|
|
.select((s) => s.tracks),
|
|
);
|
|
|
|
return Scaffold(
|
|
appBar: const PageWindowTitleBar(
|
|
title: Text("Streamed songs"),
|
|
centerTitle: false,
|
|
automaticallyImplyLeading: true,
|
|
),
|
|
body: ListView.separated(
|
|
separatorBuilder: (context, index) => const Gap(8),
|
|
itemCount: topTracks.length,
|
|
itemBuilder: (context, index) {
|
|
final (:track, :count) = topTracks[index];
|
|
|
|
return StatsTrackItem(
|
|
track: track,
|
|
info: Text(
|
|
"${compactNumberFormatter.format(count)} streams",
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|