spotube/lib/components/Artist/ArtistCard.dart
Kingkor Roy Tirtho d608fa7d02 PlayerOverlay works as expected
imageToUrlString uses uuid instead of DateTime.now()
seperated parts of Player for reuse accross different sizes of screen's specific widgets
integrating go_router to follow declarative route approach
2022-03-10 12:29:29 +06:00

66 lines
2.0 KiB
Dart

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:spotify/spotify.dart';
import 'package:spotube/components/Artist/ArtistProfile.dart';
import 'package:spotube/components/Shared/SpotubePageRoute.dart';
class ArtistCard extends StatelessWidget {
final Artist artist;
const ArtistCard(this.artist, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final backgroundImage = CachedNetworkImageProvider((artist
.images?.isNotEmpty ??
false)
? artist.images!.first.url!
: "https://avatars.dicebear.com/api/open-peeps/${artist.id}.png?b=%231ed760&r=50&flip=1&translateX=3&translateY=-6");
return InkWell(
onTap: () {
Navigator.of(context).push(SpotubePageRoute(
child: ArtistProfile(
artist.id!,
key: Key("artist-${artist.id}"),
),
));
},
borderRadius: BorderRadius.circular(10),
child: Ink(
width: 200,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
blurRadius: 10,
offset: const Offset(0, 3),
spreadRadius: 5,
color: Theme.of(context).shadowColor)
],
),
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
children: [
CircleAvatar(
maxRadius: 80,
minRadius: 20,
backgroundImage: backgroundImage,
),
Text(
artist.name!,
style: Theme.of(context).textTheme.headline5,
overflow: TextOverflow.ellipsis,
),
Text(
"Artist",
style: Theme.of(context).textTheme.subtitle1,
)
],
),
),
),
);
}
}