This commit is contained in:
Gustavo Moreno 2025-05-04 03:42:12 +00:00 committed by GitHub
commit 4809b11ed3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 93 additions and 82 deletions

View File

@ -8,6 +8,7 @@ import 'package:spotube/components/image/universal_image.dart';
import 'package:spotube/extensions/image.dart'; import 'package:spotube/extensions/image.dart';
import 'package:spotube/extensions/string.dart'; import 'package:spotube/extensions/string.dart';
import 'package:spotube/provider/spotify/spotify.dart'; import 'package:spotube/provider/spotify/spotify.dart';
import 'package:spotube/utils/platform.dart';
import 'package:stroke_text/stroke_text.dart'; import 'package:stroke_text/stroke_text.dart';
class GenreSectionCardPlaylistCard extends HookConsumerWidget { class GenreSectionCardPlaylistCard extends HookConsumerWidget {
@ -21,8 +22,10 @@ class GenreSectionCardPlaylistCard extends HookConsumerWidget {
Widget build(BuildContext context, ref) { Widget build(BuildContext context, ref) {
final theme = Theme.of(context); final theme = Theme.of(context);
final w = kIsDesktop ? 20 : 0;
return Container( return Container(
width: 115 * theme.scaling, width: (115 + w) * theme.scaling,
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.colorScheme.background.withAlpha(75), color: theme.colorScheme.background.withAlpha(75),
borderRadius: theme.borderRadiusMd, borderRadius: theme.borderRadiusMd,
@ -65,7 +68,7 @@ class GenreSectionCardPlaylistCard extends HookConsumerWidget {
ref.watch(playlistImageProvider(playlist.id!)); ref.watch(playlistImageProvider(playlist.id!));
return SizedBox( return SizedBox(
height: 100 * theme.scaling, height: 100 * theme.scaling,
width: 100 * theme.scaling, width: (100 + w) * theme.scaling,
child: Stack( child: Stack(
children: [ children: [
Positioned.fill( Positioned.fill(
@ -107,14 +110,14 @@ class GenreSectionCardPlaylistCard extends HookConsumerWidget {
), ),
fit: BoxFit.cover, fit: BoxFit.cover,
height: 100 * theme.scaling, height: 100 * theme.scaling,
width: 100 * theme.scaling, width: (100 + w) * theme.scaling,
), ),
), ),
Text( Text(
playlist.name!, playlist.name!,
maxLines: 2, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
).semiBold().small(), ).xSmall().bold(),
if (playlist.description != null) if (playlist.description != null)
Text( Text(
playlist.description?.unescapeHtml().cleanHtml() ?? "", playlist.description?.unescapeHtml().cleanHtml() ?? "",

View File

@ -99,91 +99,99 @@ class LocalFolderItem extends HookConsumerWidget {
itemCount: tracks.length, itemCount: tracks.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final track = tracks[index]; final track = tracks[index];
return UniversalImage( return Expanded(
path: (track.album?.images).asUrlString( child: UniversalImage(
placeholder: ImagePlaceholder.albumArt, path: (track.album?.images).asUrlString(
placeholder: ImagePlaceholder.albumArt,
),
fit: BoxFit.cover,
), ),
fit: BoxFit.cover,
); );
}, },
), ),
), ),
const Gap(8), const Gap(8),
Stack( Expanded(
children: [ child: Stack(
Column( children: [
mainAxisSize: MainAxisSize.min, Column(
children: [ mainAxisSize: MainAxisSize.min,
Center( children: [
child: Text( Center(
isDownloadFolder child: Flexible(
? context.l10n.downloads child: Text(
: isCacheFolder isDownloadFolder
? context.l10n.cache_folder.capitalize() ? context.l10n.downloads
: basename(folder), : isCacheFolder
style: const TextStyle(fontWeight: FontWeight.bold), ? context.l10n.cache_folder.capitalize()
textAlign: TextAlign.center, : basename(folder),
maxLines: 1, style: const TextStyle(fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis, textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
Flexible(
child: Wrap(
spacing: 2,
runSpacing: 2,
children: [
for (final MapEntry(key: index, value: segment)
in segments.asMap().entries)
Text.rich(
TextSpan(
children: [
if (index != 0) const TextSpan(text: "/ "),
TextSpan(text: segment)
],
),
maxLines: 2,
).xSmall().muted(),
],
),
),
],
),
if (!isDownloadFolder && !isCacheFolder)
Align(
alignment: Alignment.topRight,
child: IconButton.ghost(
icon: const Icon(Icons.more_vert),
size: ButtonSize.small,
onPressed: () {
showDropdown(
context: context,
builder: (context) {
return DropdownMenu(
children: [
MenuButton(
leading: Icon(SpotubeIcons.folderRemove,
color: colorScheme.destructive),
child: Text(
context.l10n.remove_library_location),
onPressed: (context) {
final libraryLocations = ref
.read(userPreferencesProvider)
.localLibraryLocation;
ref
.read(userPreferencesProvider.notifier)
.setLocalLibraryLocation(
libraryLocations
.where((e) => e != folder)
.toList(),
);
},
)
],
);
},
);
},
), ),
), ),
Wrap( ],
spacing: 2, ),
runSpacing: 2,
children: [
for (final MapEntry(key: index, value: segment)
in segments.asMap().entries)
Text.rich(
TextSpan(
children: [
if (index != 0) const TextSpan(text: "/ "),
TextSpan(text: segment),
],
),
maxLines: 2,
).xSmall().muted(),
],
),
],
),
if (!isDownloadFolder && !isCacheFolder)
Align(
alignment: Alignment.topRight,
child: IconButton.ghost(
icon: const Icon(Icons.more_vert),
size: ButtonSize.small,
onPressed: () {
showDropdown(
context: context,
builder: (context) {
return DropdownMenu(
children: [
MenuButton(
leading: Icon(SpotubeIcons.folderRemove,
color: colorScheme.destructive),
child:
Text(context.l10n.remove_library_location),
onPressed: (context) {
final libraryLocations = ref
.read(userPreferencesProvider)
.localLibraryLocation;
ref
.read(userPreferencesProvider.notifier)
.setLocalLibraryLocation(
libraryLocations
.where((e) => e != folder)
.toList(),
);
},
)
],
);
},
);
},
),
),
],
), ),
const Spacer(), const Spacer(),
], ],