-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmedication_view.dart
36 lines (31 loc) · 1.1 KB
/
medication_view.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
part of medication_app;
class MedicationView extends StatefulWidget {
const MedicationView({required this.model, super.key});
final MedicationViewModel model;
@override
State<MedicationView> createState() => MedicationViewState();
}
class MedicationViewState extends State<MedicationView> {
@override
Widget build(BuildContext context) => Card(
child: ListTile(
title: Text(widget.model.name),
subtitle: Text(widget.model.description),
trailing: ListenableBuilder(
listenable: widget.model,
builder: (BuildContext context, Widget? child) =>
widget.model.taken
? const Icon(
Icons.check_box_outlined,
size: 24.0,
color: Colors.blue,
)
: const Icon(
Icons.check_box_outline_blank,
size: 24.0,
)),
onTap: medicationTaken,
),
);
void medicationTaken() => widget.model.tapped();
}