1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
import 'package:flutter/material.dart';
import 'package:pmsna1/models/album.dart';
import 'package:pmsna1/widgets/album_placeholder.dart';
class AlbumItem extends StatelessWidget {
final Album album;
const AlbumItem(this.album, {super.key});
@override
Widget build(BuildContext context) {
Color textColor = Theme.of(context).colorScheme.onSurface;
return Card(
margin: const EdgeInsets.all(5.0),
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/album', arguments: album);
},
child: Column(
children: [
FadeInImage(
placeholder: const AssetImage('assets/loading.gif'),
imageErrorBuilder: (context, error, stackTrace) =>
const AspectRatio(
aspectRatio: 1.0,
child: AlbumPlaceholder(400),
),
image: NetworkImage(album.coverUri.toString()),
fit: BoxFit.fill,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
album.title,
style: Theme.of(context)
.typography
.englishLike
.labelLarge
?.copyWith(color: textColor),
textAlign: TextAlign.center,
),
const SizedBox(height: 4.0),
Text(
album.firstReleaseDate,
style: Theme.of(context)
.typography
.englishLike
.labelMedium
?.copyWith(color: textColor),
),
const SizedBox(height: 4.0),
Text(
"(${album.primaryType})",
style: Theme.of(context)
.typography
.englishLike
.labelSmall
?.copyWith(color: textColor),
),
],
),
),
],
),
),
);
}
}
|