|
...
|
...
|
@@ -21,9 +21,11 @@ class TodaySleepCard extends StatelessWidget { |
|
|
|
int sleepDuration = healthData?.sleepDuration ?? 0;
|
|
|
|
int sleepHours = sleepDuration ~/ 3600;
|
|
|
|
int sleepMinutes = sleepDuration % 60;
|
|
|
|
Color sleepStateColor =
|
|
|
|
healthData?.sleepStateColor(context) ?? context.colors.chartGreen;
|
|
|
|
String sleepStateStr = healthData?.sleepStateStr() ?? '--';
|
|
|
|
Color sleepStateColor = sleepDuration == 0
|
|
|
|
? context.colors.textPrimary
|
|
|
|
: healthData?.sleepStateColor(context);
|
|
|
|
String sleepStateStr =
|
|
|
|
sleepDuration == 0 ? '--' : healthData?.sleepStateStr() ?? '--';
|
|
|
|
String sleepAverageHeartRate =
|
|
|
|
(healthData?.hrAvg == null || healthData?.hrAvg == 0)
|
|
|
|
? '--'
|
|
...
|
...
|
@@ -104,31 +106,49 @@ class TodayActivityCard extends StatelessWidget { |
|
|
|
return GestureDetector(
|
|
|
|
onTap: controller.toTrendActivityPage,
|
|
|
|
child: Obx(() {
|
|
|
|
var activityTarget = controller.v2ActivityTarget.value;
|
|
|
|
var healthData = controller.v2HealthData.value;
|
|
|
|
var activity = healthData?.move;
|
|
|
|
var activity = healthData?.move ?? 0;
|
|
|
|
var stand = healthData?.stand ?? 0;
|
|
|
|
var exercise = healthData?.exercise ?? 0;
|
|
|
|
var standStr = stand > 0 ? '${stand ~/ 3600}' : '--';
|
|
|
|
var exerciseStr = exercise > 0 ? '${exercise % 60}' : '--';
|
|
|
|
|
|
|
|
var activityStr = (activity > 0 && (activityTarget?.move ?? 0) > 0)
|
|
|
|
? '$activity'
|
|
|
|
: '--';
|
|
|
|
var exerciseStr = (exercise > 0 && (activityTarget?.exercise ?? 0) > 0)
|
|
|
|
? '${exercise % 60}'
|
|
|
|
: '--';
|
|
|
|
var standStr = (stand > 0 && (activityTarget?.stand ?? 0) > 0)
|
|
|
|
? '${stand ~/ 3600}'
|
|
|
|
: '--';
|
|
|
|
double activityProgress =
|
|
|
|
(activity > 0 && (activityTarget?.move ?? 0) > 0)
|
|
|
|
? (activity / (activityTarget?.move ?? 0)) * 360
|
|
|
|
: -1;
|
|
|
|
double exerciseProgress =
|
|
|
|
(exercise > 0 && (activityTarget?.exercise ?? 0) > 0)
|
|
|
|
? (exercise / (activityTarget?.exercise ?? 0)) * 360
|
|
|
|
: -1;
|
|
|
|
double standProgress = (stand > 0 && (activityTarget?.stand ?? 0) > 0)
|
|
|
|
? (stand / (activityTarget?.stand ?? 0)) * 360
|
|
|
|
: -1;
|
|
|
|
|
|
|
|
return _TodaySummaryCard(
|
|
|
|
iconAsset: 'assets/images/common/ic_exercise.png',
|
|
|
|
iconColor: const Color(0xFFFF5279),
|
|
|
|
iconColor: context.colors.warning,
|
|
|
|
title: context.l10n.fitness,
|
|
|
|
actionText: context.l10n.viewFitnessReport,
|
|
|
|
metrics: [
|
|
|
|
_MetricData(
|
|
|
|
label: context.l10n.event,
|
|
|
|
labelColor: const Color(0xFFFF5279),
|
|
|
|
labelColor: context.colors.warning,
|
|
|
|
valueSpans: [
|
|
|
|
_MetricValueSpan(
|
|
|
|
(activity == null || activity == 0) ? '--' : '$activity',
|
|
|
|
'千卡'),
|
|
|
|
_MetricValueSpan(activityStr, '千卡'),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
_MetricData(
|
|
|
|
label: context.l10n.exercise,
|
|
|
|
labelColor: const Color(0xFF3BD49D),
|
|
|
|
labelColor: context.colors.chartGreen,
|
|
|
|
valueSpans: [
|
|
|
|
_MetricValueSpan(
|
|
|
|
exerciseStr,
|
|
...
|
...
|
@@ -161,10 +181,10 @@ class TodayActivityCard extends StatelessWidget { |
|
|
|
duration: const Duration(seconds: 1),
|
|
|
|
centerCircleSizeRatio: 0.2,
|
|
|
|
gapRatio: 0.06,
|
|
|
|
sweepAngles: const [
|
|
|
|
180,
|
|
|
|
230,
|
|
|
|
180,
|
|
|
|
sweepAngles: [
|
|
|
|
activityProgress,
|
|
|
|
exerciseProgress,
|
|
|
|
standProgress
|
|
|
|
],
|
|
|
|
backgroundColors: [
|
|
|
|
context.colors.chartPink.withOpacity(0.4),
|
...
|
...
|
|