fix(artist-page): SpotubeMarqueeText used in ArtistCard crashes the app

This commit is contained in:
Kingkor Roy Tirtho 2022-09-13 09:38:12 +06:00
parent 16064f68e8
commit 427954150a

View File

@ -1,9 +1,8 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:spotify/spotify.dart'; import 'package:spotify/spotify.dart';
import 'package:spotube/components/Shared/HoverBuilder.dart'; import 'package:spotube/components/Shared/HoverBuilder.dart';
import 'package:spotube/components/Shared/SpotubeMarqueeText.dart';
import 'package:spotube/components/Shared/UniversalImage.dart'; import 'package:spotube/components/Shared/UniversalImage.dart';
import 'package:spotube/utils/type_conversion_utils.dart'; import 'package:spotube/utils/type_conversion_utils.dart';
@ -13,11 +12,12 @@ class ArtistCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final backgroundImage = final backgroundImage = UniversalImage.imageProvider(
UniversalImage.imageProvider(TypeConversionUtils.image_X_UrlString( TypeConversionUtils.image_X_UrlString(
artist.images, artist.images,
placeholder: ImagePlaceholder.artist, placeholder: ImagePlaceholder.artist,
)); ),
);
return SizedBox( return SizedBox(
height: 240, height: 240,
width: 200, width: 200,
@ -37,29 +37,52 @@ class ArtistCard extends StatelessWidget {
blurRadius: 10, blurRadius: 10,
offset: const Offset(0, 3), offset: const Offset(0, 3),
spreadRadius: 5, spreadRadius: 5,
color: Theme.of(context).shadowColor) color: Theme.of(context).shadowColor,
)
], ],
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Stack(
children: [ children: [
CircleAvatar( CircleAvatar(
maxRadius: 80, maxRadius: 80,
minRadius: 20, minRadius: 20,
backgroundImage: backgroundImage, backgroundImage: backgroundImage,
), ),
SpotubeMarqueeText( Positioned(
text: artist.name!, right: 0,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(50)),
child: const Text(
"Artist",
style: TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
AutoSizeText(
artist.name!,
maxLines: 2,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge!.copyWith( style: Theme.of(context).textTheme.bodyLarge!.copyWith(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
isHovering: isHovering,
), ),
Text(
"Artist",
style: Theme.of(context).textTheme.subtitle1,
)
], ],
), ),
), ),