|
|
|
import 'package:doublefeel_flutter/app/widget/circular_gradient_progress/combine.dart';
|
|
|
|
import 'package:doublefeel_flutter/core/config/app_environment_config.dart';
|
|
|
|
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
|
|
|
|
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
...
|
...
|
@@ -14,6 +15,8 @@ class TodaySleepCard extends StatelessWidget { |
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final l10n = context.l10n;
|
|
|
|
final isGlobal =
|
|
|
|
controller.environmentConfig.region.value == AppRegion.global;
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: controller.toTrendSleepPage,
|
|
|
|
child: Obx(() {
|
|
...
|
...
|
@@ -62,9 +65,12 @@ class TodaySleepCard extends StatelessWidget { |
|
|
|
),
|
|
|
|
children: [
|
|
|
|
if (sleepHours > 0) ...[
|
|
|
|
TextSpan(text: '$sleepHours'),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.reportUnitHour,
|
|
|
|
text: isGlobal
|
|
|
|
? '$sleepHours '
|
|
|
|
: '$sleepHours'),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.sleepDailyUnitHour,
|
|
|
|
style: TextStyle(
|
|
|
|
color: context.colors.textSecondary,
|
|
|
|
fontSize: 12,
|
|
...
|
...
|
@@ -73,9 +79,12 @@ class TodaySleepCard extends StatelessWidget { |
|
|
|
)
|
|
|
|
],
|
|
|
|
if (sleepMinutes > 0) ...[
|
|
|
|
TextSpan(text: '$sleepMinutes'),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.reportUnitMinute,
|
|
|
|
text: isGlobal
|
|
|
|
? '${sleepHours > 0 ? ' ' : ''}$sleepMinutes '
|
|
|
|
: '$sleepMinutes'),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.sleepDailyUnitMinute,
|
|
|
|
style: TextStyle(
|
|
|
|
color: context.colors.textSecondary,
|
|
|
|
fontSize: 12,
|
|
...
|
...
|
@@ -120,7 +129,7 @@ class TodaySleepCard extends StatelessWidget { |
|
|
|
children: [
|
|
|
|
TextSpan(text: sleepAverageHeartRate),
|
|
|
|
TextSpan(
|
|
|
|
text: 'bpm',
|
|
|
|
text: isGlobal ? ' bpm' : 'bpm',
|
|
|
|
style: TextStyle(
|
|
|
|
color: context.colors.textSecondary,
|
|
|
|
fontSize: 12,
|
|
...
|
...
|
@@ -174,6 +183,8 @@ class TodayActivityCard extends StatelessWidget { |
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final l10n = context.l10n;
|
|
|
|
final isGlobal =
|
|
|
|
controller.environmentConfig.region.value == AppRegion.global;
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: controller.toTrendActivityPage,
|
|
|
|
child: Obx(() {
|
|
...
|
...
|
@@ -184,7 +195,9 @@ class TodayActivityCard extends StatelessWidget { |
|
|
|
var exercise = healthData?.exercise ?? 0;
|
|
|
|
|
|
|
|
var activityStr = (activity > 0 && (activityTarget?.move ?? 0) > 0)
|
|
|
|
? '$activity'
|
|
|
|
? isGlobal
|
|
|
|
? '$activity '
|
|
|
|
: '$activity'
|
|
|
|
: '-';
|
|
|
|
// exercise 单位为秒,转换为小时+分钟
|
|
|
|
Widget exerciseWidget;
|
|
...
|
...
|
@@ -198,9 +211,10 @@ class TodayActivityCard extends StatelessWidget { |
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
children: [
|
|
|
|
TextSpan(text: '$exTotalMinutes'),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.reportUnitMinute,
|
|
|
|
text: isGlobal ? '$exTotalMinutes ' : '$exTotalMinutes'),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.activityUnitMinute,
|
|
|
|
style: TextStyle(
|
|
|
|
color: context.colors.textSecondary,
|
|
|
|
fontSize: 12,
|
|
...
|
...
|
@@ -236,9 +250,9 @@ class TodayActivityCard extends StatelessWidget { |
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
children: [
|
|
|
|
TextSpan(text: '$stand'),
|
|
|
|
TextSpan(text: isGlobal ? '$stand ' : '$stand'),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.reportUnitHour,
|
|
|
|
text: l10n.activityUnitHour,
|
|
|
|
style: TextStyle(
|
|
|
|
color: context.colors.textSecondary,
|
|
|
|
fontSize: 12,
|
...
|
...
|
|