47 lines
1.1 KiB
Dart
47 lines
1.1 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:ocarina/api/audio/audioplayer_service.dart';
|
||
|
import 'package:ocarina/util/util.dart';
|
||
|
|
||
|
/// The player widget
|
||
|
///
|
||
|
/// Showcases the playing song's details and features playback controls
|
||
|
class Player extends StatefulWidget {
|
||
|
/// The player widget
|
||
|
///
|
||
|
/// Showcases the playing song's details and features playback controls
|
||
|
const Player({super.key});
|
||
|
|
||
|
@override
|
||
|
State<Player> createState() => PlayerState();
|
||
|
}
|
||
|
|
||
|
/// State of [Player]
|
||
|
class PlayerState extends State<Player> {
|
||
|
void update() {
|
||
|
logger.d(AudioPlayerService().song?.title);
|
||
|
setState(() {});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return DraggableScrollableSheet(
|
||
|
initialChildSize: 0.1,
|
||
|
snap: true,
|
||
|
snapSizes: const [0.1, 1],
|
||
|
minChildSize: 0.1,
|
||
|
builder: (c, s) => SingleChildScrollView(
|
||
|
controller: s,
|
||
|
child: Row(
|
||
|
children: [
|
||
|
Text(
|
||
|
AudioPlayerService().song == null
|
||
|
? "Nothing"
|
||
|
: AudioPlayerService().song!.title,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|