Skip to content

Commit 9ee600b

Browse files
committed
refactor: home page
1 parent 02ba600 commit 9ee600b

3 files changed

Lines changed: 292 additions & 203 deletions

File tree

lib/app/home/_widgets/history_timeline_item.dart

Lines changed: 98 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -24,105 +24,116 @@ class HistoryTimelineItem extends StatelessWidget {
2424
Widget build(BuildContext context) {
2525
final hasDetail = shouldShowArrow(history);
2626

27-
return Stack(
28-
clipBehavior: Clip.none,
29-
children: [
30-
Positioned(
31-
left: 36.5,
32-
top: 0,
33-
bottom: last ? null : -4,
34-
height: last ? 4 : null,
35-
width: 1,
36-
child: Container(color: context.colors.outlineVariant),
37-
),
38-
Container(
39-
margin: const EdgeInsets.fromLTRB(16, 4, 16, 4),
40-
decoration: BoxDecoration(
41-
color: context.colors.surfaceContainer,
42-
borderRadius: BorderRadius.circular(12),
27+
return Container(
28+
margin: const EdgeInsets.fromLTRB(16, 4, 16, 4),
29+
child: Stack(
30+
clipBehavior: Clip.none,
31+
children: [
32+
Positioned(
33+
left: 20.5,
34+
top: -4,
35+
bottom: last ? null : -4,
36+
width: 1,
37+
child: Container(
38+
height: last ? 8 : null,
39+
color: context.colors.outlineVariant,
40+
),
4341
),
44-
child: Material(
45-
color: Colors.transparent,
46-
child: InkWell(
47-
onTap: hasDetail ? () => handleEventList(context, history) : null,
42+
Container(
43+
decoration: BoxDecoration(
44+
color: context.colors.surfaceContainer,
4845
borderRadius: BorderRadius.circular(12),
49-
child: Padding(
50-
padding: const EdgeInsets.all(12),
51-
child: Row(
52-
crossAxisAlignment: CrossAxisAlignment.start,
53-
children: [
54-
Container(
55-
height: 40,
56-
width: 40,
57-
decoration: BoxDecoration(
58-
shape: BoxShape.circle,
59-
color: expired
60-
? context.colors.surfaceContainerHighest
61-
: context.colors.primaryContainer,
62-
),
63-
child: Icon(
64-
getListIcon(history.icon),
65-
size: 20,
66-
color: expired
67-
? context.colors.outline
68-
: context.colors.onPrimaryContainer,
46+
),
47+
child: Material(
48+
color: Colors.transparent,
49+
child: InkWell(
50+
onTap: hasDetail
51+
? () => handleEventList(context, history)
52+
: null,
53+
borderRadius: BorderRadius.circular(12),
54+
child: Padding(
55+
padding: const EdgeInsets.all(12),
56+
child: Row(
57+
crossAxisAlignment: CrossAxisAlignment.start,
58+
children: [
59+
Container(
60+
height: 40,
61+
width: 40,
62+
decoration: BoxDecoration(
63+
shape: BoxShape.circle,
64+
color: expired
65+
? context.colors.surfaceContainerHighest
66+
: context.colors.primaryContainer,
67+
),
68+
child: Icon(
69+
getListIcon(history.icon),
70+
size: 20,
71+
color: expired
72+
? context.colors.outline
73+
: context.colors.onPrimaryContainer,
74+
),
6975
),
70-
),
71-
const SizedBox(width: 12),
72-
Expanded(
73-
child: Column(
74-
crossAxisAlignment: CrossAxisAlignment.start,
75-
children: [
76-
Text(
77-
DateFormat('HH:mm:ss').format(history.time.send),
78-
style: context.theme.textTheme.labelSmall?.copyWith(
79-
color: context.colors.onSurfaceVariant.withValues(
80-
alpha: expired ? 0.6 : 1,
81-
),
76+
const SizedBox(width: 12),
77+
Expanded(
78+
child: Column(
79+
crossAxisAlignment: CrossAxisAlignment.start,
80+
children: [
81+
Text(
82+
DateFormat('HH:mm:ss').format(history.time.send),
83+
style: context.theme.textTheme.labelSmall
84+
?.copyWith(
85+
color: context.colors.onSurfaceVariant
86+
.withValues(
87+
alpha: expired ? 0.6 : 1,
88+
),
89+
),
8290
),
83-
),
84-
const SizedBox(height: 2),
85-
Text(
86-
history.text.content['all']!.subtitle,
87-
style: context.theme.textTheme.titleSmall?.copyWith(
88-
color: context.colors.onSurface.withValues(
89-
alpha: expired ? 0.6 : 1,
90-
),
91-
fontWeight: FontWeight.w600,
91+
const SizedBox(height: 2),
92+
Text(
93+
history.text.content['all']!.subtitle,
94+
style: context.theme.textTheme.titleSmall
95+
?.copyWith(
96+
color: context.colors.onSurface.withValues(
97+
alpha: expired ? 0.6 : 1,
98+
),
99+
fontWeight: FontWeight.w600,
100+
),
101+
maxLines: 1,
102+
overflow: TextOverflow.ellipsis,
92103
),
93-
maxLines: 1,
94-
overflow: TextOverflow.ellipsis,
95-
),
96-
const SizedBox(height: 2),
97-
Text(
98-
history.text.description['all']!,
99-
style: context.theme.textTheme.bodySmall?.copyWith(
100-
color: context.colors.onSurfaceVariant.withValues(
101-
alpha: expired ? 0.6 : 1,
102-
),
104+
const SizedBox(height: 2),
105+
Text(
106+
history.text.description['all']!,
107+
style: context.theme.textTheme.bodySmall
108+
?.copyWith(
109+
color: context.colors.onSurfaceVariant
110+
.withValues(
111+
alpha: expired ? 0.6 : 1,
112+
),
113+
),
114+
maxLines: 2,
115+
overflow: TextOverflow.ellipsis,
103116
),
104-
maxLines: 2,
105-
overflow: TextOverflow.ellipsis,
106-
),
107-
],
108-
),
109-
),
110-
if (hasDetail)
111-
Padding(
112-
padding: const EdgeInsets.only(left: 8),
113-
child: Icon(
114-
Symbols.chevron_right_rounded,
115-
size: 20,
116-
color: context.colors.onSurfaceVariant,
117+
],
117118
),
118119
),
119-
],
120+
if (hasDetail)
121+
Padding(
122+
padding: const EdgeInsets.only(left: 8),
123+
child: Icon(
124+
Symbols.chevron_right_rounded,
125+
size: 20,
126+
color: context.colors.onSurfaceVariant,
127+
),
128+
),
129+
],
130+
),
120131
),
121132
),
122133
),
123134
),
124-
),
125-
],
135+
],
136+
),
126137
);
127138
}
128139
}

0 commit comments

Comments
 (0)