mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 13:19:44 +02:00
fix(ui): resolve album titles and show Home explicit badges
Hide the profile setup hint once a name or photo is saved.
This commit is contained in:
1 parent
5958fe2719
commit
4c5af08cdd
7 files changed
+145
-13
No files matched your search
@@ -5,6 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:spotiflac_android/models/settings.dart';
|
||||
import 'package:spotiflac_android/services/platform_bridge.dart';
|
||||
import 'package:spotiflac_android/utils/logger.dart';
|
||||
import 'package:spotiflac_android/utils/string_utils.dart';
|
||||
import 'package:spotiflac_android/providers/extension_provider.dart';
|
||||
import 'package:spotiflac_android/providers/settings_provider.dart';
|
||||
|
||||
@@ -20,6 +21,7 @@ class ExploreItem {
|
||||
final String? coverUrl;
|
||||
final String? featuredCoverUrl;
|
||||
final String? heading;
|
||||
final bool? explicit;
|
||||
final String? providerId;
|
||||
final String? albumId;
|
||||
final String? albumName;
|
||||
@@ -36,6 +38,7 @@ class ExploreItem {
|
||||
this.coverUrl,
|
||||
this.featuredCoverUrl,
|
||||
this.heading,
|
||||
this.explicit,
|
||||
this.providerId,
|
||||
this.albumId,
|
||||
this.albumName,
|
||||
@@ -54,6 +57,7 @@ class ExploreItem {
|
||||
coverUrl: json['cover_url'] as String?,
|
||||
featuredCoverUrl: json['featured_cover_url'] as String?,
|
||||
heading: json['heading'] as String?,
|
||||
explicit: parseExplicitFlag(json['explicit']),
|
||||
providerId: json['provider_id'] as String?,
|
||||
albumId: json['album_id'] as String?,
|
||||
albumName: json['album_name'] as String?,
|
||||
@@ -72,6 +76,7 @@ class ExploreItem {
|
||||
'cover_url': coverUrl,
|
||||
'featured_cover_url': featuredCoverUrl,
|
||||
'heading': heading,
|
||||
'explicit': explicit,
|
||||
'provider_id': providerId,
|
||||
'album_id': albumId,
|
||||
'album_name': albumName,
|
||||
|
||||
@@ -233,8 +233,9 @@ extension _HomeTabExploreUI on _HomeTabState {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
item.name,
|
||||
ExplicitTrackTitle(
|
||||
title: item.name,
|
||||
explicit: item.explicit == true,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: isArtist ? TextAlign.center : TextAlign.start,
|
||||
@@ -414,8 +415,9 @@ extension _HomeTabExploreUI on _HomeTabState {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.name,
|
||||
ExplicitTrackTitle(
|
||||
title: item.name,
|
||||
explicit: item.explicit == true,
|
||||
style: Theme.of(context).textTheme.titleMedium
|
||||
?.copyWith(fontWeight: FontWeight.w600),
|
||||
maxLines: 2,
|
||||
@@ -478,6 +480,7 @@ extension _HomeTabExploreUI on _HomeTabState {
|
||||
releaseDate: item.releaseDate,
|
||||
coverUrl: item.coverUrl,
|
||||
source: _providerIdForExploreItem(item),
|
||||
explicit: item.explicit,
|
||||
);
|
||||
|
||||
if (settings.askQualityBeforeDownload || settings.allowQualityVariants) {
|
||||
|
||||
@@ -1022,6 +1022,7 @@ class ExtensionAlbumScreen extends ConsumerStatefulWidget {
|
||||
|
||||
class _ExtensionAlbumScreenState extends ConsumerState<ExtensionAlbumScreen> {
|
||||
List<Track>? _tracks;
|
||||
String? _albumName;
|
||||
bool _isLoading = true;
|
||||
String? _error;
|
||||
String? _artistId;
|
||||
@@ -1074,6 +1075,9 @@ class _ExtensionAlbumScreenState extends ConsumerState<ExtensionAlbumScreen> {
|
||||
|
||||
final artistId = (albumInfo['artist_id'] ?? albumInfo['artistId'])
|
||||
?.toString();
|
||||
final albumName =
|
||||
normalizeOptionalString(albumInfo['name']?.toString()) ??
|
||||
widget.albumName;
|
||||
final artistName = (albumInfo['artists'] ?? albumInfo['artist'])
|
||||
?.toString();
|
||||
final albumType =
|
||||
@@ -1090,6 +1094,7 @@ class _ExtensionAlbumScreenState extends ConsumerState<ExtensionAlbumScreen> {
|
||||
.map(
|
||||
(t) => _parseTrack(
|
||||
t as Map<String, dynamic>,
|
||||
albumNameFallback: albumName,
|
||||
albumTypeFallback: albumType,
|
||||
totalTracksFallback: totalTracks,
|
||||
),
|
||||
@@ -1098,6 +1103,7 @@ class _ExtensionAlbumScreenState extends ConsumerState<ExtensionAlbumScreen> {
|
||||
|
||||
setState(() {
|
||||
_tracks = tracks;
|
||||
_albumName = albumName;
|
||||
_artistId = artistId;
|
||||
_artistName = artistName;
|
||||
_albumType = albumType;
|
||||
@@ -1124,13 +1130,17 @@ class _ExtensionAlbumScreenState extends ConsumerState<ExtensionAlbumScreen> {
|
||||
|
||||
Track _parseTrack(
|
||||
Map<String, dynamic> data, {
|
||||
String? albumNameFallback,
|
||||
String? albumTypeFallback,
|
||||
int? totalTracksFallback,
|
||||
}) {
|
||||
final base = Track.fromBackendMap(data, source: widget.extensionId);
|
||||
return base.copyWith(
|
||||
id: (data['id'] ?? '').toString(),
|
||||
albumName: (data['album_name'] ?? widget.albumName).toString(),
|
||||
albumName:
|
||||
normalizeOptionalString(data['album_name']?.toString()) ??
|
||||
albumNameFallback ??
|
||||
widget.albumName,
|
||||
albumArtist: normalizeOptionalString(data['album_artist']?.toString()),
|
||||
artistId: base.artistId ?? _artistId,
|
||||
albumId: base.albumId ?? widget.albumId,
|
||||
@@ -1163,7 +1173,7 @@ class _ExtensionAlbumScreenState extends ConsumerState<ExtensionAlbumScreen> {
|
||||
|
||||
return AlbumScreen(
|
||||
albumId: widget.albumId,
|
||||
albumName: widget.albumName,
|
||||
albumName: _albumName ?? widget.albumName,
|
||||
coverUrl: widget.coverUrl,
|
||||
headerVideoUrl: _headerVideoUrl,
|
||||
headerImageUrl: _headerImageUrl,
|
||||
@@ -1638,8 +1648,9 @@ class _QuickPicksPageViewState extends State<_QuickPicksPageView> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
item.name,
|
||||
ExplicitTrackTitle(
|
||||
title: item.name,
|
||||
explicit: item.explicit == true,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
|
||||
@@ -441,7 +441,11 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
subtitle: Text(context.l10n.profileEdit),
|
||||
subtitle:
|
||||
profile?.name.isNotEmpty == true ||
|
||||
profile?.photoPath?.isNotEmpty == true
|
||||
? null
|
||||
: Text(context.l10n.profileEdit),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: profile == null
|
||||
? null
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:spotiflac_android/providers/explore_provider.dart';
|
||||
import 'package:spotiflac_android/widgets/cached_cover_image.dart';
|
||||
import 'package:spotiflac_android/widgets/audio_quality_badges.dart';
|
||||
|
||||
/// Large editorial cards requested by a home-feed provider.
|
||||
class ExploreFeaturedSection extends StatelessWidget {
|
||||
@@ -92,8 +93,9 @@ class ExploreFeaturedSection extends StatelessWidget {
|
||||
),
|
||||
SizedBox(
|
||||
height: titleHeight,
|
||||
child: Text(
|
||||
item.name,
|
||||
child: ExplicitTrackTitle(
|
||||
title: item.name,
|
||||
explicit: item.explicit == true,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
|
||||
Reference in new issue
Block a user