mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-29 07:34:13 +01:00
feat(artists): connected rows for artists, releases, concerts and stats
Favorite artists, weekly releases and concerts use connected rows with empty states, statistics periods are a segmented choice, and artist and album headers follow the header palette.
This commit is contained in:
1 parent
84b5c8751b
commit
2e43ec775a
10 files changed
+421
-324
No files matched your search
@@ -656,7 +656,7 @@ class _AlbumScreenState extends ConsumerState<AlbumScreen>
|
||||
style: isDesktopPlatform
|
||||
? desktopDetailSubtitleStyle(header)
|
||||
: TextStyle(
|
||||
color: colorScheme.primary,
|
||||
color: HeaderPalette.of(header).primary,
|
||||
fontSize: context.tokens.headerSubtitleSize,
|
||||
fontWeight: context.isMornye
|
||||
? FontWeight.w400
|
||||
|
||||
@@ -246,7 +246,7 @@ class _ArtistAlbumTypeBadge extends StatelessWidget {
|
||||
: context.l10n.releaseTypeSingle,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -8,9 +8,12 @@ import 'package:mornye/theme/mornye_theme.dart';
|
||||
import 'package:mornye/utils/adaptive_layout.dart';
|
||||
import 'package:mornye/utils/nav_bar_inset.dart';
|
||||
import 'package:mornye/widgets/album_detail_header.dart';
|
||||
import 'package:mornye/widgets/app_icon.dart';
|
||||
import 'package:mornye/widgets/app_shape.dart';
|
||||
import 'package:mornye/widgets/cached_cover_image.dart';
|
||||
import 'package:mornye/widgets/animation_utils.dart';
|
||||
import 'package:mornye/widgets/error_card.dart';
|
||||
import 'package:mornye/widgets/settings_group.dart';
|
||||
|
||||
class ArtistConcertsScreen extends StatefulWidget {
|
||||
const ArtistConcertsScreen({
|
||||
@@ -56,6 +59,8 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
|
||||
Widget _buildPage(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
final mornye = context.isMornye;
|
||||
final inset = wideListInset(context) + 24;
|
||||
final locale = Localizations.localeOf(context).toString();
|
||||
return Scaffold(
|
||||
@@ -84,13 +89,15 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
child: SizedBox.square(
|
||||
dimension: 96,
|
||||
child: widget.coverUrl == null || widget.coverUrl!.isEmpty
|
||||
? const Icon(Icons.person, size: 56)
|
||||
? const AppIcon.adaptive(Icons.person, size: 56)
|
||||
: CachedCoverImage(
|
||||
imageUrl: widget.coverUrl!,
|
||||
fit: BoxFit.cover,
|
||||
memCacheWidth: 288,
|
||||
errorWidget: (_, _, _) =>
|
||||
const Icon(Icons.person, size: 56),
|
||||
errorWidget: (_, _, _) => const AppIcon.adaptive(
|
||||
Icons.person,
|
||||
size: 56,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -101,17 +108,15 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
children: [
|
||||
Text(
|
||||
context.l10n.artistUpcomingConcerts,
|
||||
style: TextStyle(
|
||||
style: textTheme.labelLarge?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.artistName,
|
||||
style: const TextStyle(
|
||||
fontSize: 28,
|
||||
style: textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -127,8 +132,7 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: Text(
|
||||
context.l10n.artistAllUpcomingConcerts,
|
||||
style: const TextStyle(
|
||||
fontSize: 21,
|
||||
style: textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -138,7 +142,10 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.all(inset),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: Text(context.l10n.artistNoUpcomingConcerts),
|
||||
child: EmptyState(
|
||||
icon: Icons.event_busy_outlined,
|
||||
title: context.l10n.artistNoUpcomingConcerts,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
@@ -146,8 +153,9 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
padding: EdgeInsets.symmetric(horizontal: inset),
|
||||
sliver: SliverList.separated(
|
||||
itemCount: widget.concerts.length,
|
||||
separatorBuilder: (_, _) =>
|
||||
const Divider(height: 1, indent: 60),
|
||||
separatorBuilder: (_, _) => mornye
|
||||
? const Divider(height: 1, indent: 60)
|
||||
: const SizedBox(height: 2),
|
||||
itemBuilder: (context, index) {
|
||||
final concert = widget.concerts[index];
|
||||
final date = DateFormat.MMMEd(locale).format(concert.date);
|
||||
@@ -158,11 +166,16 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
if (concert.hasTime)
|
||||
DateFormat.Hm(locale).format(concert.date),
|
||||
].join(' · ');
|
||||
return InkWell(
|
||||
final row = InkWell(
|
||||
onTap: () => _openConcert(context, concert),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: mornye ? BorderRadius.circular(12) : null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: mornye
|
||||
? const EdgeInsets.symmetric(vertical: 5)
|
||||
: const EdgeInsets.symmetric(
|
||||
horizontal: 14,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Semantics(
|
||||
@@ -172,11 +185,13 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
width: 48,
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.surfaceContainerHigh,
|
||||
color: mornye
|
||||
? scheme.surfaceContainerHigh
|
||||
: scheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
border: Border.all(
|
||||
color: scheme.outlineVariant,
|
||||
),
|
||||
border: mornye
|
||||
? Border.all(color: scheme.outlineVariant)
|
||||
: null,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -189,7 +204,7 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
color: scheme.primary,
|
||||
fontSize: 10,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
@@ -198,8 +213,7 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(
|
||||
DateFormat.d(locale).format(concert.date),
|
||||
style: const TextStyle(
|
||||
fontSize: 28,
|
||||
style: textTheme.headlineMedium?.copyWith(
|
||||
height: 1.05,
|
||||
),
|
||||
),
|
||||
@@ -215,7 +229,7 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
children: [
|
||||
Text(
|
||||
concert.location,
|
||||
style: const TextStyle(fontSize: 16),
|
||||
style: textTheme.bodyLarge,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
@@ -234,8 +248,7 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
1.3
|
||||
? null
|
||||
: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
style: textTheme.bodySmall?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -246,6 +259,17 @@ class _ArtistConcertsScreenState extends State<ArtistConcertsScreen> {
|
||||
),
|
||||
),
|
||||
);
|
||||
if (mornye) return row;
|
||||
return Material(
|
||||
color: settingsGroupColor(context),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
borderRadius: connectedRowRadius(
|
||||
context,
|
||||
first: index == 0,
|
||||
last: index == widget.concerts.length - 1,
|
||||
),
|
||||
child: row,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -185,7 +185,7 @@ extension _ArtistScreenSections on _ArtistScreenState {
|
||||
icon: CupertinoIcons.shuffle,
|
||||
buttonSize: 50,
|
||||
iconSize: 24,
|
||||
iconColor: colorScheme.primary,
|
||||
iconColor: Colors.white,
|
||||
glassTintColor: Colors.white,
|
||||
glassTintOpacity: 0.10,
|
||||
tooltip: context.l10n.actionShuffle,
|
||||
@@ -220,9 +220,11 @@ extension _ArtistScreenSections on _ArtistScreenState {
|
||||
: CupertinoIcons.star,
|
||||
buttonSize: 50,
|
||||
iconSize: 24,
|
||||
iconColor: colorScheme.primary,
|
||||
glassTintColor: Colors.white,
|
||||
glassTintOpacity: 0.10,
|
||||
iconColor: Colors.white,
|
||||
glassTintColor: isFavoriteArtist
|
||||
? colorScheme.primary
|
||||
: Colors.white,
|
||||
glassTintOpacity: isFavoriteArtist ? 0.45 : 0.10,
|
||||
tooltip: isFavoriteArtist
|
||||
? context.l10n.artistOptionRemoveFromFavorites
|
||||
: context.l10n.artistOptionAddToFavorites,
|
||||
|
||||
@@ -90,14 +90,9 @@ class _ConcertDetailScreenState extends State<ConcertDetailScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final source = _detail.coverUrl ?? widget.coverUrl;
|
||||
if (!context.isMornye) {
|
||||
// Material follows the app brightness with a cover-seeded scheme.
|
||||
return CoverPaletteBuilder(
|
||||
imageSource: source,
|
||||
builder: (context, palette) => Theme(
|
||||
data: Theme.of(context).copyWith(colorScheme: palette),
|
||||
child: Builder(builder: (context) => _materialPage(context, source)),
|
||||
),
|
||||
);
|
||||
// Material keeps the page on the app scheme; only the header takes the
|
||||
// cover-derived palette.
|
||||
return _materialPage(context, source);
|
||||
}
|
||||
final base = MornyeTheme.fromContext(context, brightness: Brightness.dark);
|
||||
return Theme(
|
||||
@@ -208,12 +203,15 @@ class _ConcertDetailScreenState extends State<ConcertDetailScreen> {
|
||||
child: SizedBox.square(
|
||||
dimension: photoSize,
|
||||
child: source == null
|
||||
? const Icon(Icons.person, size: 96)
|
||||
? const AppIcon.adaptive(Icons.person, size: 96)
|
||||
: CachedCoverImage(
|
||||
imageUrl: source,
|
||||
fit: BoxFit.cover,
|
||||
errorWidget: (_, _, _) =>
|
||||
const Icon(Icons.person, size: 96),
|
||||
const AppIcon.adaptive(
|
||||
Icons.person,
|
||||
size: 96,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -224,7 +222,9 @@ class _ConcertDetailScreenState extends State<ConcertDetailScreen> {
|
||||
width: 64,
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xff202023),
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.white24),
|
||||
),
|
||||
@@ -232,9 +232,9 @@ class _ConcertDetailScreenState extends State<ConcertDetailScreen> {
|
||||
children: [
|
||||
Text(
|
||||
DateFormat.MMM(locale).format(date),
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xffff646b),
|
||||
color: CupertinoColors.systemRed.darkColor,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
@@ -406,7 +406,9 @@ class _ConcertDetailScreenState extends State<ConcertDetailScreen> {
|
||||
child: SizedBox.square(
|
||||
dimension: 88,
|
||||
child: _detail.setListCover == null
|
||||
? const Icon(Icons.queue_music)
|
||||
? const AppIcon.adaptive(
|
||||
Icons.queue_music,
|
||||
)
|
||||
: CachedCoverImage(
|
||||
imageUrl: _detail.setListCover!,
|
||||
fit: BoxFit.cover,
|
||||
@@ -481,124 +483,142 @@ class _ConcertDetailScreenState extends State<ConcertDetailScreen> {
|
||||
],
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
AppShapeClip(
|
||||
kind: AppShapes.artist,
|
||||
child: SizedBox.square(
|
||||
dimension: photoSize,
|
||||
child: source == null
|
||||
? ColoredBox(
|
||||
color: scheme.surfaceContainerHigh,
|
||||
child: placeholder,
|
||||
)
|
||||
: CachedCoverImage(
|
||||
imageUrl: source,
|
||||
fit: BoxFit.cover,
|
||||
errorWidget: (_, _, _) => placeholder,
|
||||
),
|
||||
),
|
||||
),
|
||||
PositionedDirectional(
|
||||
end: -4,
|
||||
bottom: -4,
|
||||
child: Container(
|
||||
width: 64,
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.primaryContainer,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
child: CoverPaletteBuilder(
|
||||
imageSource: source,
|
||||
builder: (context, palette) => Theme(
|
||||
data: Theme.of(context).copyWith(colorScheme: palette),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final headerScheme = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Text(
|
||||
DateFormat.MMM(locale).format(date),
|
||||
style: textTheme.labelLarge?.copyWith(
|
||||
color: scheme.onPrimaryContainer,
|
||||
fontWeight: FontWeight.w600,
|
||||
AppShapeClip(
|
||||
kind: AppShapes.artist,
|
||||
child: SizedBox.square(
|
||||
dimension: photoSize,
|
||||
child: source == null
|
||||
? ColoredBox(
|
||||
color:
|
||||
headerScheme.surfaceContainerHigh,
|
||||
child: placeholder,
|
||||
)
|
||||
: CachedCoverImage(
|
||||
imageUrl: source,
|
||||
fit: BoxFit.cover,
|
||||
errorWidget: (_, _, _) => placeholder,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
DateFormat.d(locale).format(date),
|
||||
style: textTheme.headlineMedium?.copyWith(
|
||||
color: scheme.onPrimaryContainer,
|
||||
height: 1.1,
|
||||
PositionedDirectional(
|
||||
end: -4,
|
||||
bottom: -4,
|
||||
child: Container(
|
||||
width: 64,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: headerScheme.primaryContainer,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
DateFormat.MMM(locale).format(date),
|
||||
style: textTheme.labelLarge?.copyWith(
|
||||
color:
|
||||
headerScheme.onPrimaryContainer,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
DateFormat.d(locale).format(date),
|
||||
style: textTheme.headlineMedium
|
||||
?.copyWith(
|
||||
color: headerScheme
|
||||
.onPrimaryContainer,
|
||||
height: 1.1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
artist,
|
||||
textAlign: TextAlign.center,
|
||||
style: textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: scheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (_loading) ...[
|
||||
const SizedBox(height: 24),
|
||||
const ShimmerLoading(
|
||||
child: Column(
|
||||
children: [
|
||||
SkeletonBox(
|
||||
width: double.infinity,
|
||||
height: 48,
|
||||
borderRadius: 24,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
SkeletonBox(
|
||||
width: double.infinity,
|
||||
height: 144,
|
||||
borderRadius: 20,
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
artist,
|
||||
textAlign: TextAlign.center,
|
||||
style: textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: headerScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (_loading) ...[
|
||||
const SizedBox(height: 24),
|
||||
const ShimmerLoading(
|
||||
child: Column(
|
||||
children: [
|
||||
SkeletonBox(
|
||||
width: double.infinity,
|
||||
height: 48,
|
||||
borderRadius: 24,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
SkeletonBox(
|
||||
width: double.infinity,
|
||||
height: 144,
|
||||
borderRadius: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
] else if (hasTicket || hasSetList) ...[
|
||||
const SizedBox(height: 24),
|
||||
// Tickets are the one filled action; the set list is tonal.
|
||||
Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
if (hasTicket)
|
||||
Expanded(
|
||||
child: ExpressiveButton(
|
||||
onPressed: () =>
|
||||
_openLink(_detail.ticketUrl!),
|
||||
icon: const Icon(
|
||||
Icons.confirmation_number_outlined,
|
||||
),
|
||||
child: Text(
|
||||
context.l10n.concertGetTickets,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasSetList)
|
||||
Expanded(
|
||||
child: ExpressiveButton(
|
||||
tonal: true,
|
||||
onPressed: _openSetList,
|
||||
icon: const Icon(Icons.queue_music),
|
||||
child: Text(
|
||||
context.l10n.concertSetListButton,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
] else if (hasTicket || hasSetList) ...[
|
||||
const SizedBox(height: 24),
|
||||
// Tickets are the one filled action; the set list is tonal.
|
||||
Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
if (hasTicket)
|
||||
Expanded(
|
||||
child: ExpressiveButton(
|
||||
onPressed: () => _openLink(_detail.ticketUrl!),
|
||||
icon: const Icon(
|
||||
Icons.confirmation_number_outlined,
|
||||
),
|
||||
child: Text(
|
||||
context.l10n.concertGetTickets,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasSetList)
|
||||
Expanded(
|
||||
child: ExpressiveButton(
|
||||
tonal: true,
|
||||
onPressed: _openSetList,
|
||||
icon: const Icon(Icons.queue_music),
|
||||
child: Text(
|
||||
context.l10n.concertSetListButton,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -10,9 +10,13 @@ import 'package:mornye/theme/mornye_theme.dart';
|
||||
import 'package:mornye/utils/adaptive_layout.dart';
|
||||
import 'package:mornye/utils/nav_bar_inset.dart';
|
||||
import 'package:mornye/widgets/animation_utils.dart';
|
||||
import 'package:mornye/widgets/app_icon.dart';
|
||||
import 'package:mornye/widgets/app_icon_button.dart';
|
||||
import 'package:mornye/widgets/app_shape.dart';
|
||||
import 'package:mornye/widgets/app_sliver_header.dart';
|
||||
import 'package:mornye/widgets/app_snack_bar.dart';
|
||||
import 'package:mornye/widgets/error_card.dart';
|
||||
import 'package:mornye/widgets/settings_group.dart';
|
||||
|
||||
class FavoriteArtistsScreen extends ConsumerWidget {
|
||||
const FavoriteArtistsScreen({super.key});
|
||||
@@ -23,68 +27,50 @@ class FavoriteArtistsScreen extends ConsumerWidget {
|
||||
libraryCollectionsProvider.select((state) => state.favoriteArtists),
|
||||
);
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final bottomInset = context.navBarBottomInset;
|
||||
final mornye = context.isMornye;
|
||||
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
AppSliverHeader.page(title: context.l10n.collectionFavoriteArtists),
|
||||
SliverToBoxAdapter(
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.new_releases_outlined),
|
||||
title: Text(context.l10n.weeklyReleases),
|
||||
subtitle: Text(context.l10n.weeklyReleasesDescription),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.of(
|
||||
context,
|
||||
).push(slidePageRoute<void>(page: const WeeklyReleasesScreen())),
|
||||
child: SettingsGroup(
|
||||
children: [
|
||||
SettingsItem(
|
||||
icon: Icons.new_releases_outlined,
|
||||
showIconInMornye: true,
|
||||
title: context.l10n.weeklyReleases,
|
||||
subtitle: context.l10n.weeklyReleasesDescription,
|
||||
showDivider: false,
|
||||
onTap: () => Navigator.of(context).push(
|
||||
slidePageRoute<void>(page: const WeeklyReleasesScreen()),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (artists.isEmpty)
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.favorite,
|
||||
size: 60,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
context.l10n.collectionFavoriteArtistsEmptyTitle,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
context.l10n.collectionFavoriteArtistsEmptySubtitle,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: EmptyState(
|
||||
icon: Icons.favorite,
|
||||
title: context.l10n.collectionFavoriteArtistsEmptyTitle,
|
||||
message: context.l10n.collectionFavoriteArtistsEmptySubtitle,
|
||||
),
|
||||
)
|
||||
else
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: wideListInset(context)),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: wideListInset(context) + (mornye ? 0 : 16),
|
||||
),
|
||||
sliver: SliverList.separated(
|
||||
itemCount: artists.length,
|
||||
// Material lists separate rows by space; dividers are Mornye's.
|
||||
separatorBuilder: (_, _) => context.isMornye
|
||||
separatorBuilder: (_, _) => mornye
|
||||
? const Divider(height: 1)
|
||||
: const SizedBox.shrink(),
|
||||
: const SizedBox(height: 2),
|
||||
itemBuilder: (context, index) {
|
||||
final artist = artists[index];
|
||||
return ListTile(
|
||||
final tile = ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 4,
|
||||
@@ -111,12 +97,11 @@ class FavoriteArtistsScreen extends ConsumerWidget {
|
||||
.read(libraryCollectionsProvider.notifier)
|
||||
.removeFavoriteArtist(artist.key);
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
context.l10n.collectionRemovedFromFavoriteArtists(
|
||||
artist.name,
|
||||
),
|
||||
showAppSnackBar(
|
||||
context,
|
||||
content: Text(
|
||||
context.l10n.collectionRemovedFromFavoriteArtists(
|
||||
artist.name,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -139,10 +124,21 @@ class FavoriteArtistsScreen extends ConsumerWidget {
|
||||
);
|
||||
},
|
||||
);
|
||||
if (mornye) return tile;
|
||||
return Material(
|
||||
color: settingsGroupColor(context),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
borderRadius: connectedRowRadius(
|
||||
context,
|
||||
first: index == 0,
|
||||
last: index == artists.length - 1,
|
||||
),
|
||||
child: tile,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(child: SizedBox(height: bottomInset)),
|
||||
const NavBarSliverSpacer(),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -180,7 +176,10 @@ class _ArtistThumbnail extends StatelessWidget {
|
||||
width: 56,
|
||||
height: 56,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
child: Icon(Icons.person, color: colorScheme.onSurfaceVariant),
|
||||
child: AppIcon.adaptive(
|
||||
Icons.person,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,17 @@ import 'package:mornye/theme/app_motion.dart';
|
||||
import 'package:mornye/theme/material_expressive.dart';
|
||||
import 'package:mornye/theme/mornye_theme.dart';
|
||||
import 'package:mornye/utils/adaptive_layout.dart';
|
||||
import 'package:mornye/utils/nav_bar_inset.dart';
|
||||
import 'package:mornye/widgets/animation_utils.dart' show SkeletonBox;
|
||||
import 'package:mornye/widgets/app_alert_dialog.dart';
|
||||
import 'package:mornye/widgets/app_choice_chip.dart';
|
||||
import 'package:mornye/widgets/app_content_card.dart';
|
||||
import 'package:mornye/widgets/app_icon.dart';
|
||||
import 'package:mornye/widgets/app_icon_button.dart';
|
||||
import 'package:mornye/widgets/app_progress_indicator.dart';
|
||||
import 'package:mornye/widgets/app_refresh_indicator.dart';
|
||||
import 'package:mornye/widgets/app_shape.dart';
|
||||
import 'package:mornye/widgets/app_snack_bar.dart';
|
||||
import 'package:mornye/widgets/error_card.dart';
|
||||
import 'package:mornye/widgets/expressive_button.dart';
|
||||
import 'package:mornye/widgets/app_sliver_header.dart';
|
||||
import 'package:mornye/widgets/player_artwork.dart';
|
||||
@@ -56,8 +60,9 @@ class _ListeningStatisticsScreenState
|
||||
ref.invalidate(listeningRewindSpotlightProvider);
|
||||
} catch (_) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(context.l10n.listeningStatsClearError)),
|
||||
showAppSnackBar(
|
||||
context,
|
||||
content: Text(context.l10n.listeningStatsClearError),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
@@ -70,110 +75,127 @@ class _ListeningStatisticsScreenState
|
||||
final period = (days: _days, year: _year);
|
||||
final summary = ref.watch(listeningSummaryProvider(period));
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Scaffold(
|
||||
body: AppRefreshIndicator(
|
||||
onRefresh: () => ref.refresh(listeningSummaryProvider(period).future),
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
AppSliverHeader.page(title: context.l10n.listeningStats),
|
||||
AppRefreshIndicator.sliver(),
|
||||
// Centered at the reading width on tablets, under the title.
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: wideListInset(context)),
|
||||
sliver: SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: SettingsGroup(
|
||||
children: [
|
||||
SettingsSwitchItem(
|
||||
icon: Icons.insights_outlined,
|
||||
title: context.l10n.listeningStatsRecord,
|
||||
subtitle: context.l10n.listeningStatsDescription,
|
||||
value: ref
|
||||
.watch(settingsProvider)
|
||||
.listeningStatisticsEnabled,
|
||||
enabled: !_clearing,
|
||||
onChanged: (value) => ref
|
||||
.read(settingsProvider.notifier)
|
||||
.setListeningStatisticsEnabled(value),
|
||||
showDivider: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(child: ListeningRewindEntry()),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
return MornyeSettingsTheme(
|
||||
child: Scaffold(
|
||||
body: AppRefreshIndicator(
|
||||
onRefresh: () => ref.refresh(listeningSummaryProvider(period).future),
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
AppSliverHeader.page(title: context.l10n.listeningStats),
|
||||
AppRefreshIndicator.sliver(),
|
||||
// Centered at the reading width on tablets, under the title.
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: wideListInset(context),
|
||||
),
|
||||
sliver: SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: SettingsGroup(
|
||||
children: [
|
||||
for (final days in [7, 30, 0])
|
||||
AppChoiceChip(
|
||||
label: Text(
|
||||
days == 0
|
||||
? '$_year'
|
||||
: context.l10n.listeningStatsDays(days),
|
||||
),
|
||||
selected: _days == days,
|
||||
onSelected: (_) => setState(() => _days = days),
|
||||
),
|
||||
if (_days == 0)
|
||||
AppIconButton(
|
||||
tooltip: context.l10n.listeningStatsPreviousYear,
|
||||
onPressed: () => setState(() => _year--),
|
||||
icon: const Icon(Icons.chevron_left),
|
||||
),
|
||||
if (_days == 0)
|
||||
AppIconButton(
|
||||
tooltip: context.l10n.listeningStatsNextYear,
|
||||
onPressed: _year >= DateTime.now().year
|
||||
? null
|
||||
: () => setState(() => _year++),
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
SettingsSwitchItem(
|
||||
icon: Icons.insights_outlined,
|
||||
title: context.l10n.listeningStatsRecord,
|
||||
subtitle: context.l10n.listeningStatsDescription,
|
||||
value: ref
|
||||
.watch(settingsProvider)
|
||||
.listeningStatisticsEnabled,
|
||||
enabled: !_clearing,
|
||||
onChanged: (value) => ref
|
||||
.read(settingsProvider.notifier)
|
||||
.setListeningStatisticsEnabled(value),
|
||||
showDivider: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
...summary.when(
|
||||
loading: () => [
|
||||
SliverToBoxAdapter(child: _summarySkeleton(context)),
|
||||
],
|
||||
error: (error, _) => [
|
||||
SliverToBoxAdapter(
|
||||
child: ListTile(
|
||||
title: Text(context.l10n.listeningStatsLoadError),
|
||||
trailing: AppIconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: () => ref.invalidate(
|
||||
listeningSummaryProvider(period),
|
||||
const SliverToBoxAdapter(child: ListeningRewindEntry()),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SettingsSegmentedChoice<int>(
|
||||
selected: _days,
|
||||
onChanged: (days) => setState(() => _days = days),
|
||||
semanticLabel: context.l10n.listeningStats,
|
||||
options: [
|
||||
for (final days in [7, 30, 0])
|
||||
SettingsSegmentOption(
|
||||
value: days,
|
||||
label: days == 0
|
||||
? '$_year'
|
||||
: context.l10n.listeningStatsDays(days),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
data: (data) => _summarySlivers(context, data),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 24, 16, 48),
|
||||
child: ExpressiveButton(
|
||||
text: true,
|
||||
onPressed: _clearing ? null : _clear,
|
||||
icon: Icon(Icons.delete_outline, color: colors.error),
|
||||
child: Text(
|
||||
context.l10n.listeningStatsClear,
|
||||
style: TextStyle(color: colors.error),
|
||||
if (_days == 0) ...[
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
AppIconButton(
|
||||
tooltip:
|
||||
context.l10n.listeningStatsPreviousYear,
|
||||
onPressed: () => setState(() => _year--),
|
||||
icon: const Icon(Icons.chevron_left),
|
||||
),
|
||||
AppIconButton(
|
||||
tooltip:
|
||||
context.l10n.listeningStatsNextYear,
|
||||
onPressed: _year >= DateTime.now().year
|
||||
? null
|
||||
: () => setState(() => _year++),
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
...summary.when(
|
||||
loading: () => [
|
||||
SliverToBoxAdapter(child: _summarySkeleton(context)),
|
||||
],
|
||||
error: (error, _) => [
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: ErrorCard(
|
||||
error: context.l10n.listeningStatsLoadError,
|
||||
colorScheme: colors,
|
||||
onRetry: () => ref.invalidate(
|
||||
listeningSummaryProvider(period),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
data: (data) => _summarySlivers(context, data),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 24, 16, 48),
|
||||
child: ExpressiveButton(
|
||||
text: true,
|
||||
onPressed: _clearing ? null : _clear,
|
||||
icon: Icon(Icons.delete_outline, color: colors.error),
|
||||
child: Text(
|
||||
context.l10n.listeningStatsClear,
|
||||
style: TextStyle(color: colors.error),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
const NavBarSliverSpacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -395,9 +417,10 @@ class _ListeningStatisticsScreenState
|
||||
fraction: day.value / peakDay,
|
||||
peak: day.value == peakDay,
|
||||
)
|
||||
: LinearProgressIndicator(
|
||||
: AppProgressIndicator.linear(
|
||||
value: day.value / peakDay,
|
||||
minHeight: 8,
|
||||
wavy: false,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
@@ -432,7 +455,9 @@ class _ListeningStatisticsScreenState
|
||||
child: artistArtwork[artist.key] == null
|
||||
? ColoredBox(
|
||||
color: colors.surfaceContainerHighest,
|
||||
child: const Icon(Icons.person_outline),
|
||||
child: const AppIcon.adaptive(
|
||||
Icons.person_outline,
|
||||
),
|
||||
)
|
||||
: PlayerArtwork(
|
||||
artUri: artistArtwork[artist.key],
|
||||
|
||||
@@ -20,6 +20,8 @@ import 'package:mornye/services/library_database.dart';
|
||||
import 'package:mornye/utils/adaptive_layout.dart';
|
||||
import 'package:mornye/utils/nav_bar_inset.dart';
|
||||
import 'package:mornye/widgets/app_bottom_sheet.dart';
|
||||
import 'package:mornye/widgets/app_icon.dart';
|
||||
import 'package:mornye/widgets/app_loading_indicator.dart';
|
||||
import 'package:mornye/widgets/open_audio_button.dart';
|
||||
import 'package:mornye/widgets/tv_navigation.dart';
|
||||
import 'package:mornye/widgets/app_refresh_indicator.dart';
|
||||
@@ -544,7 +546,7 @@ class _MornyeLibraryScreenState extends ConsumerState<MornyeLibraryScreen> {
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
minVerticalPadding: 12,
|
||||
leading: Icon(
|
||||
leading: AppIcon.adaptive(
|
||||
category.$1,
|
||||
color: colors.primary,
|
||||
size: 28,
|
||||
@@ -553,7 +555,7 @@ class _MornyeLibraryScreenState extends ConsumerState<MornyeLibraryScreen> {
|
||||
category.$2,
|
||||
style: const TextStyle(fontSize: 22),
|
||||
),
|
||||
trailing: Icon(
|
||||
trailing: AppIcon.adaptive(
|
||||
Icons.chevron_right,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
@@ -718,10 +720,11 @@ class _MornyeLibraryScreenState extends ConsumerState<MornyeLibraryScreen> {
|
||||
if (result.hasError || result.value?.loadMoreError != null)
|
||||
SliverToBoxAdapter(
|
||||
child: Center(
|
||||
child: TextButton.icon(
|
||||
child: ExpressiveButton(
|
||||
text: true,
|
||||
onPressed: reload,
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: Text(context.l10n.dialogRetry),
|
||||
icon: const AppIcon.adaptive(Icons.refresh),
|
||||
child: Text(context.l10n.dialogRetry),
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -729,7 +732,7 @@ class _MornyeLibraryScreenState extends ConsumerState<MornyeLibraryScreen> {
|
||||
const SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Center(child: CircularProgressIndicator.adaptive()),
|
||||
child: Center(child: AppLoadingIndicator()),
|
||||
),
|
||||
)
|
||||
else if (_rows.isEmpty)
|
||||
|
||||
@@ -4,8 +4,10 @@ import 'package:intl/intl.dart';
|
||||
import 'package:mornye/controllers/clickable_metadata.dart';
|
||||
import 'package:mornye/l10n/l10n.dart';
|
||||
import 'package:mornye/providers/weekly_releases_provider.dart';
|
||||
import 'package:mornye/theme/mornye_theme.dart';
|
||||
import 'package:mornye/utils/adaptive_layout.dart';
|
||||
import 'package:mornye/utils/nav_bar_inset.dart';
|
||||
import 'package:mornye/widgets/app_icon.dart';
|
||||
import 'package:mornye/widgets/app_loading_indicator.dart';
|
||||
import 'package:mornye/widgets/app_refresh_indicator.dart';
|
||||
import 'package:mornye/widgets/app_sliver_header.dart';
|
||||
@@ -113,20 +115,27 @@ class _WeeklyReleasesScreenState extends ConsumerState<WeeklyReleasesScreen> {
|
||||
),
|
||||
if (releases.isEmpty)
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Text(context.l10n.weeklyReleasesEmpty),
|
||||
child: EmptyState(
|
||||
icon: Icons.new_releases_outlined,
|
||||
title: context.l10n.weeklyReleasesEmpty,
|
||||
),
|
||||
),
|
||||
SliverList.list(
|
||||
children: [
|
||||
for (final release in releases)
|
||||
ListTile(
|
||||
if (releases.isNotEmpty)
|
||||
SliverList.separated(
|
||||
itemCount: releases.length,
|
||||
separatorBuilder: (_, _) => context.isMornye
|
||||
? const Divider(height: 1, indent: 88)
|
||||
: const SizedBox(height: 2),
|
||||
itemBuilder: (context, index) {
|
||||
final release = releases[index];
|
||||
final tile = ListTile(
|
||||
leading: release.coverUrl == null
|
||||
? const SizedBox(
|
||||
width: 56,
|
||||
height: 56,
|
||||
child: Icon(Icons.album_outlined),
|
||||
child: AppIcon.adaptive(
|
||||
Icons.album_outlined,
|
||||
),
|
||||
)
|
||||
: CachedCoverImage(
|
||||
imageUrl: release.coverUrl!,
|
||||
@@ -146,18 +155,32 @@ class _WeeklyReleasesScreenState extends ConsumerState<WeeklyReleasesScreen> {
|
||||
coverUrl: release.coverUrl,
|
||||
extensionId: release.providerId,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (context.isMornye) return tile;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: Material(
|
||||
color: settingsGroupColor(context),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
borderRadius: connectedRowRadius(
|
||||
context,
|
||||
first: index == 0,
|
||||
last: index == releases.length - 1,
|
||||
),
|
||||
child: tile,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(height: context.navBarBottomInset),
|
||||
),
|
||||
const NavBarSliverSpacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -50,7 +50,8 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('1 play · 1 track · 1 active day'), findsOneWidget);
|
||||
await tester.tap(find.text('${DateTime.now().year}'));
|
||||
// The expressive segmented group also lays out a measuring copy.
|
||||
await tester.tap(find.text('${DateTime.now().year}').first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(requested.last.days, 0);
|
||||
expect(requested.last.year, DateTime.now().year);
|
||||
|
||||
Reference in new issue
Block a user