RhythmBox/lib/widgets/player/track_details.dart

50 lines
1.5 KiB
Dart
Raw Normal View History

2024-08-27 06:35:16 +00:00
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rhythm_box/providers/audio_player.dart';
import 'package:rhythm_box/services/artist.dart';
import 'package:spotify/spotify.dart';
class PlayerTrackDetails extends StatelessWidget {
final Color? color;
final Track? track;
const PlayerTrackDetails({super.key, this.color, this.track});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final AudioPlayerProvider playback = Get.find();
return Row(
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 4),
InkWell(
child: Text(
2024-08-27 06:48:31 +00:00
playback.state.value.activeTrack?.name ?? 'Not playing',
2024-08-27 06:35:16 +00:00
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.bodyMedium!.copyWith(
color: color,
),
),
onTap: () {
// TODO Push to track page
},
),
Text(
playback.state.value.activeTrack?.artists?.asString() ??
2024-08-27 06:48:31 +00:00
'No author',
2024-08-27 06:35:16 +00:00
overflow: TextOverflow.ellipsis,
style: theme.textTheme.bodySmall!.copyWith(color: color),
)
],
),
),
],
);
}
}