status_preview_card.dart
2.25 KB
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
import 'package:doublefeel_flutter/core/util/size_extensions.dart';
import 'package:flutter/material.dart';
import 'watch_theme_character_avatar.dart';
import 'watch_theme_colors.dart';
import 'watch_theme_section_card.dart';
class StatusPreviewCard extends StatelessWidget {
const StatusPreviewCard({super.key});
static const _items = [
_StatusPreviewItem('状态优秀', WatchThemeColors.excellent,
icon: 'assets/images/watch_theme/official_default_green.png'),
_StatusPreviewItem('状态正常', WatchThemeColors.normal,
icon: 'assets/images/watch_theme/official_default_blue.png'),
_StatusPreviewItem('注意压力', WatchThemeColors.stress,
icon: 'assets/images/watch_theme/official_default_orange.png'),
_StatusPreviewItem('压力过载', WatchThemeColors.overload,
icon: 'assets/images/watch_theme/official_default_red.png'),
];
@override
Widget build(BuildContext context) {
return WatchThemeSectionCard(
padding: EdgeInsets.fromLTRB(20.dp, 20.dp, 20.dp, 17.dp),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const WatchThemeSectionTitle('状态预览'),
SizedBox(height: 24.dp),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
for (final item in _items)
Column(
children: [
WatchThemeCharacterAvatar(
size: 60,
useDefaultCharacter: true,
backgroundColor: item.color,
assetPath: item.icon,
),
SizedBox(height: 4.dp),
Text(
item.title,
style: TextStyle(
color: item.color,
fontSize: 12.dp,
fontWeight: FontWeight.w400,
height: 1.25,
),
),
],
),
],
),
],
),
);
}
}
class _StatusPreviewItem {
const _StatusPreviewItem(this.title, this.color, {required this.icon});
final String title;
final Color color;
final String icon;
}