Better explore

This commit is contained in:
2024-08-30 01:38:02 +08:00
parent bb09c43135
commit be977f10d1
9 changed files with 308 additions and 30 deletions

View File

@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rhythm_box/widgets/auto_cache_image.dart';
import 'package:rhythm_box/services/artist.dart';
import 'package:spotify/spotify.dart';
class AlbumCard extends StatelessWidget {
final AlbumSimple? item;
final Function? onTap;
const AlbumCard({super.key, required this.item, this.onTap});
@override
Widget build(BuildContext context) {
return Card(
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: AspectRatio(
aspectRatio: 1,
child: (item?.images?.isNotEmpty ?? false)
? AutoCacheImage(item!.images!.first.url!)
: const Center(child: Icon(Icons.image)),
),
).paddingSymmetric(vertical: 8),
Text(
item?.name ?? 'Loading...',
style: Theme.of(context).textTheme.bodyLarge,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Expanded(
child: Text(
item?.artists?.asString() ?? 'Please stand by...',
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
),
],
).paddingSymmetric(horizontal: 8),
onTap: () {
if (onTap != null) return;
onTap!();
},
),
);
}
}