interact_route_arguments.dart
1.24 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
/// Typed context passed from a health-data entry to the interaction page.
///
/// Keep values atomic: a sleep or fitness card is represented by several
/// [InteractDisplayValue]s instead of flattening them into one localized
/// string. The interaction page and the request payload can therefore format
/// the same data independently.
class InteractRouteArguments {
const InteractRouteArguments({
required this.friendUserId,
required this.page,
required this.title,
required this.date,
required this.values,
});
final int friendUserId;
final InteractPageSource page;
final String title;
final DateTime date;
final List<InteractDisplayValue> values;
}
enum InteractPageSource { home }
enum InteractValueType {
averageHrv,
restingHeartRate,
sleepDuration,
sleepQualityScore,
sleepQualityState,
averageSleepHeartRate,
activeCalories,
exerciseDuration,
standDuration,
}
enum InteractValueUnit {
milliseconds,
beatsPerMinute,
seconds,
kilocalories,
hours,
score,
state,
}
class InteractDisplayValue {
const InteractDisplayValue({
required this.type,
required this.value,
required this.unit,
});
final InteractValueType type;
final num value;
final InteractValueUnit unit;
}