From 648cbf97a7e54fd1d473e9235d15ecdea6608963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Mon, 27 May 2024 21:46:54 +0200 Subject: [PATCH] fix: user cover art instead of artist image url --- lib/api/subsonic/artist.dart | 4 ++++ lib/views/artist_view.dart | 2 +- lib/views/home_view.dart | 2 +- lib/widgets/hero_banner.dart | 7 ++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/api/subsonic/artist.dart b/lib/api/subsonic/artist.dart index ab70e0c..8d43314 100644 --- a/lib/api/subsonic/artist.dart +++ b/lib/api/subsonic/artist.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:ocarina/api/subsonic/subsonic.dart'; part 'artist.g.dart'; @JsonSerializable() @@ -34,4 +35,7 @@ class Artist { /// Artist image URL final String artistImageUrl; + + /// Returns the cover art URL formed from the [coverArtId] + String get coverArt => SubsonicApiService().getCoverArtUrl(coverArtId); } diff --git a/lib/views/artist_view.dart b/lib/views/artist_view.dart index 93bea3a..c279581 100644 --- a/lib/views/artist_view.dart +++ b/lib/views/artist_view.dart @@ -45,7 +45,7 @@ class _ArtistViewState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ HeroBanner( - imageUrl: widget.artist.artistImageUrl, + imageUrl: widget.artist.coverArt, title: widget.artist.name, description: "This could be a cool description soon", heroTag: widget.artist.name, diff --git a/lib/views/home_view.dart b/lib/views/home_view.dart index e9a4acf..5accb30 100644 --- a/lib/views/home_view.dart +++ b/lib/views/home_view.dart @@ -116,7 +116,7 @@ class _HomeViewState extends State { ); }, child: ImageCover( - imageUrl: index.artists[n].artistImageUrl, + imageUrl: index.artists[n].coverArt, title: index.artists[n].name, heroTag: index.artists[n].name, ), diff --git a/lib/widgets/hero_banner.dart b/lib/widgets/hero_banner.dart index 22579b0..dc2e972 100644 --- a/lib/widgets/hero_banner.dart +++ b/lib/widgets/hero_banner.dart @@ -1,7 +1,9 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:responsive_sizer/responsive_sizer.dart'; import 'package:shimmer/shimmer.dart'; +import 'package:text_scroll/text_scroll.dart'; class HeroBanner extends StatelessWidget { const HeroBanner({ @@ -60,7 +62,10 @@ class HeroBanner extends StatelessWidget { const SizedBox( height: 5, ), - Text(description), + AutoSizeText( + description, + overflowReplacement: TextScroll(description), + ), ], ), ],