RhythmBox/lib/widgets/tracks/track_list.dart

34 lines
796 B
Dart
Raw Normal View History

2024-08-28 13:07:58 +00:00
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rhythm_box/providers/audio_player.dart';
2024-08-29 08:42:48 +00:00
import 'package:rhythm_box/widgets/tracks/track_tile.dart';
2024-08-28 13:07:58 +00:00
import 'package:spotify/spotify.dart';
class TrackSliverList extends StatelessWidget {
final List<Track> tracks;
const TrackSliverList({
super.key,
required this.tracks,
});
@override
Widget build(BuildContext context) {
return SliverList.builder(
itemCount: tracks.length,
itemBuilder: (context, idx) {
final item = tracks[idx];
2024-08-29 08:42:48 +00:00
return TrackTile(
item: item,
2024-08-28 13:07:58 +00:00
onTap: () {
Get.find<AudioPlayerProvider>().load(
[item],
autoPlay: true,
);
},
);
},
);
}
}