62 lines
1.9 KiB
Dart
62 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../services/audio_service.dart';
|
|
import 'full_player_page.dart';
|
|
|
|
class MiniPlayerBar extends StatelessWidget {
|
|
const MiniPlayerBar({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final service = context.watch<AudioService>();
|
|
final song = service.currentSong!;
|
|
|
|
return GestureDetector(
|
|
onTap: () => Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (_) => const FullPlayerPage()),
|
|
),
|
|
child: Container(
|
|
height: 64,
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xFF1A1F1E),
|
|
border: Border(top: BorderSide(color: Colors.white10, width: 0.5)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const SizedBox(width: 12),
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF2A3332),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: const Icon(Icons.music_note, color: Colors.white38),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(song.title,
|
|
style: const TextStyle(
|
|
fontSize: 14, fontWeight: FontWeight.w500)),
|
|
Text(song.artist,
|
|
style: TextStyle(fontSize: 12, color: Colors.grey[400])),
|
|
],
|
|
),
|
|
),
|
|
IconButton(
|
|
icon: Icon(service.isPlaying ? Icons.pause : Icons.play_arrow),
|
|
onPressed: () => context.read<AudioService>().togglePlay(),
|
|
),
|
|
const SizedBox(width: 8),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|