mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00

* feat: add riverpod based favorite album provider * feat: add album is saved, new releases and tracks providers * feat: add artist related providers * feat: add all categories providers * feat: add lyrics provider * feat: add playlist related providers * feat: add search provider * feat: add view and spotify friends provider * feat: add playlist create and update and favorite handlers * feat: use providers in home screen * chore: fix dart lint issues * feat: use new providers for playlist and albums screen * feat: use providers in artist page * feat: use providers on library page * feat: use provider for playlist and album card and heart button * feat: use provider in search page * feat: use providers in generate playlist * feat: use provider in lyrics screen * feat: use provider for create playlist * feat: use provider in add track dialog * feat: use providers in remaining pages and remove fl_query * fix: remove direct access to provider.value * fix: glitching when loading * fix: user album loading next page indicator * feat: make many provider autoDispose after 5 minutes of no usage * fix: ignore episodes in tracks
126 lines
4.1 KiB
Dart
126 lines
4.1 KiB
Dart
import 'package:auto_size_text/auto_size_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:skeletonizer/skeletonizer.dart';
|
|
|
|
import 'package:spotify/spotify.dart';
|
|
import 'package:spotube/components/shared/image/universal_image.dart';
|
|
import 'package:spotube/extensions/context.dart';
|
|
import 'package:spotube/hooks/utils/use_breakpoint_value.dart';
|
|
import 'package:spotube/hooks/utils/use_brightness_value.dart';
|
|
import 'package:spotube/provider/blacklist_provider.dart';
|
|
import 'package:spotube/utils/service_utils.dart';
|
|
import 'package:spotube/utils/type_conversion_utils.dart';
|
|
|
|
class ArtistCard extends HookConsumerWidget {
|
|
final Artist artist;
|
|
const ArtistCard(this.artist, {super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final theme = Theme.of(context);
|
|
final backgroundImage = UniversalImage.imageProvider(
|
|
TypeConversionUtils.image_X_UrlString(
|
|
artist.images,
|
|
placeholder: ImagePlaceholder.artist,
|
|
),
|
|
);
|
|
final isBlackListed = ref.watch(
|
|
BlackListNotifier.provider.select(
|
|
(blacklist) => blacklist.contains(
|
|
BlacklistedElement.artist(artist.id!, artist.name!),
|
|
),
|
|
),
|
|
);
|
|
|
|
final radius = BorderRadius.circular(15);
|
|
|
|
final double size = useBreakpointValue<double>(
|
|
xs: 130,
|
|
sm: 130,
|
|
md: 150,
|
|
others: 170,
|
|
);
|
|
|
|
return Container(
|
|
width: size,
|
|
margin: const EdgeInsets.symmetric(vertical: 5),
|
|
child: Material(
|
|
shadowColor: theme.colorScheme.background,
|
|
color: Color.lerp(
|
|
theme.colorScheme.surfaceVariant,
|
|
theme.colorScheme.surface,
|
|
useBrightnessValue(.9, .7),
|
|
),
|
|
elevation: 3,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: radius,
|
|
side: isBlackListed
|
|
? const BorderSide(
|
|
color: Colors.red,
|
|
width: 2,
|
|
)
|
|
: BorderSide.none,
|
|
),
|
|
child: InkWell(
|
|
onTap: () {
|
|
ServiceUtils.push(context, "/artist/${artist.id}");
|
|
},
|
|
borderRadius: radius,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: Column(
|
|
children: [
|
|
Stack(
|
|
children: [
|
|
ConstrainedBox(
|
|
constraints: BoxConstraints(
|
|
maxHeight: size,
|
|
),
|
|
child: CircleAvatar(
|
|
backgroundImage: backgroundImage,
|
|
radius: size / 2,
|
|
),
|
|
),
|
|
Positioned(
|
|
right: 0,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 10,
|
|
vertical: 5,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.blue,
|
|
borderRadius: BorderRadius.circular(50)),
|
|
child: Skeleton.ignore(
|
|
child: Text(
|
|
context.l10n.artist,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 10),
|
|
AutoSizeText(
|
|
artist.name!,
|
|
maxLines: 1,
|
|
textAlign: TextAlign.center,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)),
|
|
),
|
|
);
|
|
}
|
|
}
|