-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
character_stack_image.dart
62 lines (58 loc) · 1.68 KB
/
character_stack_image.dart
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
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:shiori/presentation/shared/images/rarity.dart';
import 'package:shiori/presentation/shared/styles.dart';
import 'package:transparent_image/transparent_image.dart';
class CharacterStackImage extends StatelessWidget {
final String name;
final String image;
final int rarity;
final double height;
final VoidCallback? onTap;
final BoxFit fit;
const CharacterStackImage({
super.key,
required this.name,
required this.image,
required this.rarity,
this.onTap,
this.height = 280,
this.fit = BoxFit.fitHeight,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return InkWell(
onTap: onTap == null ? null : () => onTap!(),
child: Stack(
alignment: Alignment.bottomLeft,
fit: StackFit.passthrough,
children: [
FadeInImage(
placeholder: MemoryImage(kTransparentImage),
height: height,
fit: fit,
image: FileImage(File(image)),
),
Container(
color: Colors.black.withOpacity(0.5),
padding: Styles.edgeInsetAll10,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Center(
child: Text(
name,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold, color: Colors.white),
),
),
Rarity(stars: rarity),
],
),
),
],
),
);
}
}