mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-16 00:55:17 +00:00

Configuration File Removals: .vscode/c_cpp_properties.json: Removed the entire configuration for C/C++ properties. .vscode/launch.json: Removed the Dart launch configurations for different environments and modes. .vscode/settings.json: Removed settings related to CMake, spell checking, file nesting, and Dart Flutter SDK path. .vscode/snippets.code-snippets: Removed code snippets for Dart, including PaginatedState and PaginatedNotifier templates. .vscode/tasks.json: Removed the tasks configuration file. Documentation Updates: CONTRIBUTION.md: Removed heart emoji from the introductory text. README.md: Updated the logo image and made minor text adjustments, including removing emojis and updating section titles. [1] [2] [3] [4] [5] Asset Removals: lib/collections/assets.gen.dart: Removed multiple unused asset references, including images related to Spotube logos and banners. [1] [2] [3] Minor Code Cleanups: cli/commands/build/linux.dart, cli/commands/build/windows.dart, cli/commands/translated.dart, cli/commands/untranslated.dart: Adjusted import statements for consistency. [1] [2] [3] [4] integration_test/app_test.dart: Removed an unnecessary blank line. lib/collections/routes.dart: Commented out the TrackRoute configuration.
117 lines
4.2 KiB
Dart
117 lines
4.2 KiB
Dart
import 'package:auto_route/auto_route.dart';
|
|
import 'package:flutter/gestures.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter_extension.dart';
|
|
import 'package:spotube/collections/routes.gr.dart';
|
|
import 'package:spotube/collections/spotube_icons.dart';
|
|
import 'package:spotube/components/image/universal_image.dart';
|
|
import 'package:spotube/models/spotify_friends.dart';
|
|
import 'package:spotube/provider/spotify/spotify.dart';
|
|
|
|
class FriendItem extends HookConsumerWidget {
|
|
final SpotifyFriendActivity friend;
|
|
const FriendItem({
|
|
super.key,
|
|
required this.friend,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final spotify = ref.watch(spotifyProvider);
|
|
|
|
return Card(
|
|
padding: const EdgeInsets.all(8),
|
|
child: Row(
|
|
children: [
|
|
Avatar(
|
|
initials: Avatar.getInitials(friend.user.name),
|
|
provider: UniversalImage.imageProvider(
|
|
friend.user.imageUrl,
|
|
),
|
|
),
|
|
const Gap(8),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
friend.user.name,
|
|
style: context.theme.typography.bold,
|
|
),
|
|
RichText(
|
|
text: TextSpan(
|
|
style: context.theme.typography.normal.copyWith(
|
|
color: context.theme.colorScheme.foreground,
|
|
),
|
|
children: [
|
|
TextSpan(
|
|
text: friend.track.name,
|
|
recognizer: TapGestureRecognizer()
|
|
..onTap = () {
|
|
context
|
|
.navigateTo(TrackRoute(trackId: friend.track.id));
|
|
},
|
|
),
|
|
const TextSpan(text: " • "),
|
|
const WidgetSpan(
|
|
child: Icon(
|
|
SpotubeIcons.artist,
|
|
size: 12,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: " ${friend.track.artist.name}",
|
|
recognizer: TapGestureRecognizer()
|
|
..onTap = () {
|
|
context.navigateTo(
|
|
ArtistRoute(artistId: friend.track.artist.id),
|
|
);
|
|
},
|
|
),
|
|
const TextSpan(text: "\n"),
|
|
TextSpan(
|
|
text: friend.track.context.name,
|
|
recognizer: TapGestureRecognizer()
|
|
..onTap = () async {
|
|
context.router.navigateNamed(
|
|
"/${friend.track.context.path}",
|
|
// extra:
|
|
// !friend.track.context.path.startsWith("album")
|
|
// ? null
|
|
// : await spotify.albums
|
|
// .get(friend.track.context.id),
|
|
);
|
|
},
|
|
),
|
|
const TextSpan(text: " • "),
|
|
const WidgetSpan(
|
|
child: Icon(
|
|
SpotubeIcons.album,
|
|
size: 12,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: " ${friend.track.album.name}",
|
|
recognizer: TapGestureRecognizer()
|
|
..onTap = () async {
|
|
final album = await spotify.invoke(
|
|
(api) => api.albums.get(friend.track.album.id),
|
|
);
|
|
if (context.mounted) {
|
|
context.navigateTo(
|
|
AlbumRoute(id: album.id!, album: album),
|
|
);
|
|
}
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|