💫 More synced player
This commit is contained in:
@@ -545,6 +545,7 @@ class _PlayerControls extends HookWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: StreamBuilder<bool>(
|
icon: StreamBuilder<bool>(
|
||||||
stream: player.stream.shuffle,
|
stream: player.stream.shuffle,
|
||||||
|
initialData: player.state.shuffle,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final shuffle = snapshot.data ?? false;
|
final shuffle = snapshot.data ?? false;
|
||||||
return Icon(
|
return Icon(
|
||||||
@@ -569,13 +570,25 @@ class _PlayerControls extends HookWidget {
|
|||||||
// Play/Pause
|
// Play/Pause
|
||||||
StreamBuilder<bool>(
|
StreamBuilder<bool>(
|
||||||
stream: player.stream.playing,
|
stream: player.stream.playing,
|
||||||
|
initialData: player.state.playing,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final playing = snapshot.data ?? false;
|
final playing = snapshot.data ?? false;
|
||||||
return IconButton.filled(
|
return IconButton.filled(
|
||||||
icon: Icon(
|
icon: AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 100),
|
||||||
|
transitionBuilder:
|
||||||
|
(Widget child, Animation<double> animation) {
|
||||||
|
return ScaleTransition(
|
||||||
|
scale: animation,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
playing ? Icons.pause : Icons.play_arrow,
|
playing ? Icons.pause : Icons.play_arrow,
|
||||||
|
key: ValueKey<bool>(playing),
|
||||||
size: 48,
|
size: 48,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
onPressed: playing ? player.pause : player.play,
|
onPressed: playing ? player.pause : player.play,
|
||||||
iconSize: 48,
|
iconSize: 48,
|
||||||
);
|
);
|
||||||
@@ -592,6 +605,7 @@ class _PlayerControls extends HookWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: StreamBuilder<PlaylistMode>(
|
icon: StreamBuilder<PlaylistMode>(
|
||||||
stream: player.stream.playlistMode,
|
stream: player.stream.playlistMode,
|
||||||
|
initialData: player.state.playlistMode,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final mode = snapshot.data ?? PlaylistMode.none;
|
final mode = snapshot.data ?? PlaylistMode.none;
|
||||||
IconData icon;
|
IconData icon;
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ class MiniPlayer extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
StreamBuilder<bool>(
|
StreamBuilder<bool>(
|
||||||
stream: player.stream.playing,
|
stream: player.stream.playing,
|
||||||
|
initialData: player.state.playing,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final playing = snapshot.data ?? false;
|
final playing = snapshot.data ?? false;
|
||||||
return Padding(
|
return Padding(
|
||||||
|
|||||||
Reference in New Issue
Block a user