friend_health_data.dart
1.72 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
import 'package:doublefeel_flutter/data/models/friend/friend_models.dart'
as api_models;
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'friend_stress_state.dart';
class FriendHealthData {
const FriendHealthData({
required this.friendItem,
this.userId,
this.avatarUrl,
required this.name,
this.remark,
required this.updatedAt,
required this.sleepQualityScore,
required this.steps,
required this.stressState,
this.isOnWatchFace = false,
});
final api_models.FriendItem friendItem;
final int? userId;
final String? avatarUrl;
final String name;
final String? remark;
final String updatedAt;
final int? sleepQualityScore;
final String? steps;
final FriendStressState stressState;
final bool isOnWatchFace;
String get displayName {
final value = remark?.trim();
if (value == null || value.isEmpty) return name;
return l10n.friendsRemarkedDisplayName(value, name);
}
FriendHealthData copyWith({
api_models.FriendItem? friendItem,
int? userId,
String? avatarUrl,
String? name,
String? remark,
String? updatedAt,
int? sleepQualityScore,
String? steps,
FriendStressState? stressState,
bool? isOnWatchFace,
}) {
return FriendHealthData(
friendItem: friendItem ?? this.friendItem,
userId: userId ?? this.userId,
avatarUrl: avatarUrl ?? this.avatarUrl,
name: name ?? this.name,
remark: remark ?? this.remark,
updatedAt: updatedAt ?? this.updatedAt,
sleepQualityScore: sleepQualityScore ?? this.sleepQualityScore,
steps: steps ?? this.steps,
stressState: stressState ?? this.stressState,
isOnWatchFace: isOnWatchFace ?? this.isOnWatchFace,
);
}
}