feat:增加变化提醒功能
This commit is contained in:
@@ -30,7 +30,7 @@ String formatTime(TimeOfDay time) {
|
||||
return '${time.hour.toString().padLeft(2, '0')}:${time.minute.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
int calSleepMinuteDuration(String startTime, String endTime) {
|
||||
int calSleepMinDuration(String startTime, String endTime) {
|
||||
final start = parseTime(startTime);
|
||||
final end = parseTime(endTime);
|
||||
|
||||
@@ -48,7 +48,7 @@ int calSleepMinuteDuration(String startTime, String endTime) {
|
||||
// 计算睡眠时长
|
||||
String calSleepDuration(String startTime, String endTime) {
|
||||
try {
|
||||
int durationMinutes = calSleepMinuteDuration(startTime, endTime);
|
||||
int durationMinutes = calSleepMinDuration(startTime, endTime);
|
||||
int hours = durationMinutes ~/ 60;
|
||||
int minutes = durationMinutes % 60;
|
||||
|
||||
@@ -58,7 +58,7 @@ String calSleepDuration(String startTime, String endTime) {
|
||||
}
|
||||
}
|
||||
|
||||
double roundNum(double value) {
|
||||
double roundNum(num value) {
|
||||
return double.parse(value.toStringAsFixed(2));
|
||||
}
|
||||
|
||||
@@ -87,9 +87,9 @@ String formatContent(HealthRecord record, RecordType type) {
|
||||
late String title;
|
||||
switch (type) {
|
||||
case RecordType.weight:
|
||||
title = "${record.weight} kg";
|
||||
title = "${record.weight} ${type.unit}";
|
||||
case RecordType.sport:
|
||||
title = "${record.sportProject} · ${record.sportDuration} 分钟";
|
||||
title = "${record.sportProject} · ${record.sportDuration} ${type.unit}";
|
||||
case RecordType.sleep:
|
||||
final startTime = record.sleepStartTime;
|
||||
final endTime = record.sleepEndTime;
|
||||
|
||||
Reference in New Issue
Block a user