From cefda904de254e21d7d0b7ba8d954d515f77c9eb Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Fri, 10 May 2024 17:54:43 +0600 Subject: [PATCH] feat: add text to explain user how hypothetical fees are calculated --- lib/pages/stats/fees/fees.dart | 44 +++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/lib/pages/stats/fees/fees.dart b/lib/pages/stats/fees/fees.dart index e5bb9330..228d3243 100644 --- a/lib/pages/stats/fees/fees.dart +++ b/lib/pages/stats/fees/fees.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:sliver_tools/sliver_tools.dart'; import 'package:spotube/collections/formatters.dart'; import 'package:spotube/components/shared/page_window_title_bar.dart'; import 'package:spotube/components/stats/common/artist_item.dart'; @@ -13,6 +14,8 @@ class StatsStreamFeesPage extends HookConsumerWidget { @override Widget build(BuildContext context, ref) { + final ThemeData(:textTheme, :hintColor) = Theme.of(context); + final artists = ref.watch( playbackHistoryTopProvider(HistoryDuration.days30) .select((value) => value.artists), @@ -24,15 +27,38 @@ class StatsStreamFeesPage extends HookConsumerWidget { centerTitle: false, title: Text("Streaming fees (hypothetical)"), ), - body: ListView.builder( - itemCount: artists.length, - itemBuilder: (context, index) { - final artist = artists[index]; - return StatsArtistItem( - artist: artist.artist, - info: Text(usdFormatter.format(artist.count * 0.005)), - ); - }, + body: CustomScrollView( + slivers: [ + SliverCrossAxisConstrained( + maxCrossAxisExtent: 600, + alignment: -1, + child: SliverPadding( + padding: const EdgeInsets.all(16.0), + sliver: SliverToBoxAdapter( + child: Text( + "*This is calculated based on Spotify's per stream " + "payout of \$0.003 to \$0.005. This is a hypothetical " + "calculation to give user insight about how much they " + "would have paid to the artists if they were to listen " + "their song in Spotify.", + style: textTheme.bodySmall?.copyWith( + color: hintColor, + ), + ), + ), + ), + ), + SliverList.builder( + itemCount: artists.length, + itemBuilder: (context, index) { + final artist = artists[index]; + return StatsArtistItem( + artist: artist.artist, + info: Text(usdFormatter.format(artist.count * 0.005)), + ); + }, + ), + ], ), ); }