Improve new UI

This commit is contained in:
Pierre HUBERT 2022-10-01 15:56:22 +02:00
parent 25e64f67e0
commit fa8f72c376

View File

@ -17,7 +17,7 @@ extension DurationExt on Duration {
} }
} }
const double playlistWidth = 300; const smartphoneSize = 700;
class MusicPlayer extends StatefulWidget { class MusicPlayer extends StatefulWidget {
final MusicsList musicsList; final MusicsList musicsList;
@ -291,7 +291,10 @@ class _MusicPlayerState extends State<MusicPlayer> {
), ),
); );
Widget _buildSmallPlayerWidget(double width) => fluent.Container( Widget _buildSmallPlayerWidget(double width) {
var partSize = width > smartphoneSize ? width / 3 : width / 2.5;
return fluent.Container(
color: Colors.black, color: Colors.black,
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@ -300,11 +303,8 @@ class _MusicPlayerState extends State<MusicPlayer> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
fluent.ClipRect( fluent.ClipRect(
child: Flexible( child: SizedBox(
flex: 1, width: partSize,
child: ConstrainedBox(
constraints:
BoxConstraints(maxWidth: min(350, width * (1 / 2))),
child: Row( child: Row(
children: [ children: [
RoundedImage( RoundedImage(
@ -340,12 +340,8 @@ class _MusicPlayerState extends State<MusicPlayer> {
), ),
), ),
), ),
), SizedBox(
const Spacer(), width: partSize,
Flexible(
child: ConstrainedBox(
constraints:
BoxConstraints(maxWidth: min(500, width * (1 / 4))),
child: Column( child: Column(
children: [ children: [
fluent.Row( fluent.Row(
@ -361,13 +357,13 @@ class _MusicPlayerState extends State<MusicPlayer> {
_buildPlayersIcons(25), _buildPlayersIcons(25),
], ],
)), )),
),
const Spacer(), const Spacer(),
_buildToggleListButton() _buildToggleListButton()
], ],
), ),
), ),
); );
}
Widget _buildPlayersIcons([double? size]) => fluent.Row( Widget _buildPlayersIcons([double? size]) => fluent.Row(
children: [ children: [