diff --git a/lib/player/mini_player.dart b/lib/player/mini_player.dart index f964e61..ad26243 100644 --- a/lib/player/mini_player.dart +++ b/lib/player/mini_player.dart @@ -26,44 +26,85 @@ class MiniPlayer extends StatelessWidget { onTap: () => Navigator.of(context).push(MaterialPageRoute( builder: (_) => const NowPlayingScreen(), )), - child: SizedBox( - height: 60, - child: Row( - children: [ - const SizedBox(width: 8), - Padding( - padding: const EdgeInsets.all(8), - child: CoverImage(artUri: item.artUri, size: 44, radius: 6), - ), - const SizedBox(width: 8), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, + child: Column( + children: [ + Expanded( + child: SizedBox( + height: 80, + child: Row( children: [ - Text(item.title, - maxLines: 1, overflow: TextOverflow.ellipsis), - Text(item.artist ?? 'Unbekannt', - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white54, fontSize: 12)), + const SizedBox(width: 12), + Padding( + padding: const EdgeInsets.all(8), + child: CoverImage(artUri: item.artUri, size: 64, radius: 8), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(item.title, + maxLines: 1, overflow: TextOverflow.ellipsis, + style: const TextStyle(fontWeight: FontWeight.w600)), + Text(item.artist ?? 'Unbekannt', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: Colors.white54, fontSize: 12)), + ], + ), + ), + StreamBuilder( + stream: handler.playbackState, + builder: (context, snap) { + final playing = snap.data?.playing ?? false; + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.skip_previous), + onPressed: handler.skipToPrevious, + ), + IconButton( + tooltip: playing ? 'Pause' : 'Abspielen', + icon: Icon(playing ? Icons.pause : Icons.play_arrow, size: 28), + onPressed: playing ? handler.pause : handler.play, + ), + IconButton( + icon: const Icon(Icons.skip_next), + onPressed: handler.skipToNext, + ), + ], + ); + }, + ), + const SizedBox(width: 8), ], ), ), - StreamBuilder( - stream: handler.playbackState, - builder: (context, snap) { - final playing = snap.data?.playing ?? false; - return IconButton( - tooltip: playing ? 'Pause' : 'Abspielen', - icon: Icon(playing ? Icons.pause : Icons.play_arrow), - onPressed: playing ? handler.pause : handler.play, - ); - }, - ), - ], - ), + ), + StreamBuilder( + stream: handler.durationStream, + builder: (context, dSnap) { + final duration = dSnap.data ?? Duration.zero; + return StreamBuilder( + stream: handler.positionStream, + builder: (context, pSnap) { + final position = pSnap.data ?? Duration.zero; + return LinearProgressIndicator( + value: duration.inMilliseconds > 0 + ? (position.inMilliseconds / duration.inMilliseconds).clamp(0.0, 1.0) + : 0, + minHeight: 3, + backgroundColor: Colors.white12, + valueColor: const AlwaysStoppedAnimation(MeloTheme.red), + ); + }, + ); + }, + ), + ], ), ), );