Display music title & artist
This commit is contained in:
parent
fce5cc326e
commit
6a79a90e56
@ -10,6 +10,7 @@ class CoverImage extends StatelessWidget {
|
|||||||
final double? height;
|
final double? height;
|
||||||
final BoxFit? fit;
|
final BoxFit? fit;
|
||||||
final Icon? icon;
|
final Icon? icon;
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
const CoverImage({
|
const CoverImage({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -18,6 +19,7 @@ class CoverImage extends StatelessWidget {
|
|||||||
this.height,
|
this.height,
|
||||||
this.icon,
|
this.icon,
|
||||||
this.fit,
|
this.fit,
|
||||||
|
this.backgroundColor,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -37,7 +39,7 @@ class CoverImage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _loadingWidget(double? progress) => Container(
|
Widget _loadingWidget(double? progress) => Container(
|
||||||
color: Colors.black,
|
color: backgroundColor ?? Colors.black,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
child: Center(
|
child: Center(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:music_web_player/api.dart';
|
import 'package:music_web_player/api.dart';
|
||||||
import 'package:music_web_player/ui/cover_image.dart';
|
import 'package:music_web_player/ui/cover_image.dart';
|
||||||
@ -59,13 +60,38 @@ class _MusicPlayerState extends State<MusicPlayer> {
|
|||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
_buildFront(),
|
_buildCenter(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFront() {
|
Widget _buildCenter() {
|
||||||
return Text(currMusic.artist + " - " + currMusic.title);
|
return Center(
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Material(
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(18.0),
|
||||||
|
),
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
child: CoverImage(
|
||||||
|
width: 250,
|
||||||
|
height: 250,
|
||||||
|
music: currMusic,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
backgroundColor: Colors.black12,
|
||||||
|
icon: const Icon(FluentIcons.music_note_2_24_regular, size: 90),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
Text(currMusic.title, style: const TextStyle(fontSize: 22)),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Text(currMusic.artist),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user