mucke/lib/presentation/widgets/album_art.dart

106 lines
3.2 KiB
Dart
Raw Normal View History

2020-03-25 17:00:00 +01:00
import 'package:flutter/material.dart';
2020-04-09 17:50:28 +02:00
import '../../domain/entities/song.dart';
2020-12-31 17:52:20 +01:00
import '../theming.dart';
2020-04-09 17:50:28 +02:00
import '../utils.dart';
2020-03-25 17:00:00 +01:00
class AlbumArt extends StatelessWidget {
2020-04-09 17:50:28 +02:00
const AlbumArt({Key key, this.song}) : super(key: key);
final Song song;
2020-03-25 17:00:00 +01:00
@override
Widget build(BuildContext context) {
return AspectRatio(
aspectRatio: 1.0,
child: Card(
2020-12-08 22:22:31 +01:00
elevation: 6.0,
2020-03-25 17:00:00 +01:00
clipBehavior: Clip.antiAlias,
2020-04-09 17:50:28 +02:00
margin: const EdgeInsets.all(0),
2020-04-10 20:12:26 +02:00
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2.0),
),
2020-03-25 17:00:00 +01:00
child: Stack(
children: [
Container(
width: double.infinity,
height: double.infinity,
child: Image(
image: getAlbumImage(song.albumArtPath),
fit: BoxFit.cover,
),
2020-04-09 17:50:28 +02:00
),
2020-03-25 17:00:00 +01:00
Positioned(
bottom: 0,
left: 0,
right: 0,
2020-12-31 17:52:20 +01:00
height: 150,
2020-03-25 17:00:00 +01:00
child: Container(
2020-08-12 20:59:00 +02:00
decoration: const BoxDecoration(
2020-03-25 17:00:00 +01:00
gradient: LinearGradient(
2020-12-31 17:52:20 +01:00
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
2021-01-09 19:55:56 +01:00
colors: [Color(0x00000000), Color(0xBB000000)],
2020-12-31 17:52:20 +01:00
stops: [0.0, 1.0],
),
2020-03-25 17:00:00 +01:00
),
),
),
Positioned(
2020-03-26 10:19:36 +01:00
bottom: 0,
left: 0,
2020-12-31 17:52:20 +01:00
right: 0,
2020-03-26 10:19:36 +01:00
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
2020-04-09 17:50:28 +02:00
song.title,
2020-12-31 17:52:20 +01:00
overflow: TextOverflow.ellipsis,
// softWrap: false,
maxLines: 2,
style: TEXT_BIG.copyWith(
shadows: [
const Shadow(
blurRadius: 2.0,
2021-01-09 19:55:56 +01:00
color: Colors.black87,
2020-12-31 17:52:20 +01:00
offset: Offset(.5, .5),
),
2021-01-09 19:55:56 +01:00
const Shadow(
blurRadius: 8.0,
color: Colors.black54,
offset: Offset(0, 0),
),
2020-12-31 17:52:20 +01:00
],
),
2020-03-26 10:19:36 +01:00
),
2020-04-09 17:50:28 +02:00
Text(
song.artist,
2020-12-31 17:52:20 +01:00
style: TEXT_SUBTITLE.copyWith(
2021-01-09 19:55:56 +01:00
color: Colors.grey[100],
2020-12-31 17:52:20 +01:00
shadows: [
const Shadow(
blurRadius: 2.0,
2021-01-09 19:55:56 +01:00
color: Colors.black87,
2020-12-31 17:52:20 +01:00
offset: Offset(.5, .5),
),
2021-01-09 19:55:56 +01:00
const Shadow(
blurRadius: 8.0,
color: Colors.black54,
offset: Offset(0, 0),
),
2020-12-31 17:52:20 +01:00
],
),
2020-03-26 10:19:36 +01:00
),
],
),
2020-03-25 17:00:00 +01:00
),
),
],
),
),
);
}
}