|
1
|
import 'package:doublefeel_flutter/app/widget/circular_gradient_progress/combine.dart';
|
1
|
import 'package:doublefeel_flutter/app/widget/circular_gradient_progress/combine.dart';
|
|
|
|
2
|
+import 'package:doublefeel_flutter/core/config/app_environment_config.dart';
|
|
2
|
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
|
3
|
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
|
|
3
|
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
|
4
|
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
|
|
4
|
import 'package:flutter/material.dart';
|
5
|
import 'package:flutter/material.dart';
|
|
@@ -14,6 +15,8 @@ class TodaySleepCard extends StatelessWidget { |
|
@@ -14,6 +15,8 @@ class TodaySleepCard extends StatelessWidget { |
|
14
|
@override
|
15
|
@override
|
|
15
|
Widget build(BuildContext context) {
|
16
|
Widget build(BuildContext context) {
|
|
16
|
final l10n = context.l10n;
|
17
|
final l10n = context.l10n;
|
|
|
|
18
|
+ final isGlobal =
|
|
|
|
19
|
+ controller.environmentConfig.region.value == AppRegion.global;
|
|
17
|
return GestureDetector(
|
20
|
return GestureDetector(
|
|
18
|
onTap: controller.toTrendSleepPage,
|
21
|
onTap: controller.toTrendSleepPage,
|
|
19
|
child: Obx(() {
|
22
|
child: Obx(() {
|
|
@@ -62,9 +65,12 @@ class TodaySleepCard extends StatelessWidget { |
|
@@ -62,9 +65,12 @@ class TodaySleepCard extends StatelessWidget { |
|
62
|
),
|
65
|
),
|
|
63
|
children: [
|
66
|
children: [
|
|
64
|
if (sleepHours > 0) ...[
|
67
|
if (sleepHours > 0) ...[
|
|
65
|
- TextSpan(text: '$sleepHours'),
|
|
|
|
66
|
TextSpan(
|
68
|
TextSpan(
|
|
67
|
- text: l10n.reportUnitHour,
|
69
|
+ text: isGlobal
|
|
|
|
70
|
+ ? '$sleepHours '
|
|
|
|
71
|
+ : '$sleepHours'),
|
|
|
|
72
|
+ TextSpan(
|
|
|
|
73
|
+ text: l10n.sleepDailyUnitHour,
|
|
68
|
style: TextStyle(
|
74
|
style: TextStyle(
|
|
69
|
color: context.colors.textSecondary,
|
75
|
color: context.colors.textSecondary,
|
|
70
|
fontSize: 12,
|
76
|
fontSize: 12,
|
|
@@ -73,9 +79,12 @@ class TodaySleepCard extends StatelessWidget { |
|
@@ -73,9 +79,12 @@ class TodaySleepCard extends StatelessWidget { |
|
73
|
)
|
79
|
)
|
|
74
|
],
|
80
|
],
|
|
75
|
if (sleepMinutes > 0) ...[
|
81
|
if (sleepMinutes > 0) ...[
|
|
76
|
- TextSpan(text: '$sleepMinutes'),
|
|
|
|
77
|
TextSpan(
|
82
|
TextSpan(
|
|
78
|
- text: l10n.reportUnitMinute,
|
83
|
+ text: isGlobal
|
|
|
|
84
|
+ ? '${sleepHours > 0 ? ' ' : ''}$sleepMinutes '
|
|
|
|
85
|
+ : '$sleepMinutes'),
|
|
|
|
86
|
+ TextSpan(
|
|
|
|
87
|
+ text: l10n.sleepDailyUnitMinute,
|
|
79
|
style: TextStyle(
|
88
|
style: TextStyle(
|
|
80
|
color: context.colors.textSecondary,
|
89
|
color: context.colors.textSecondary,
|
|
81
|
fontSize: 12,
|
90
|
fontSize: 12,
|
|
@@ -120,7 +129,7 @@ class TodaySleepCard extends StatelessWidget { |
|
@@ -120,7 +129,7 @@ class TodaySleepCard extends StatelessWidget { |
|
120
|
children: [
|
129
|
children: [
|
|
121
|
TextSpan(text: sleepAverageHeartRate),
|
130
|
TextSpan(text: sleepAverageHeartRate),
|
|
122
|
TextSpan(
|
131
|
TextSpan(
|
|
123
|
- text: 'bpm',
|
132
|
+ text: isGlobal ? ' bpm' : 'bpm',
|
|
124
|
style: TextStyle(
|
133
|
style: TextStyle(
|
|
125
|
color: context.colors.textSecondary,
|
134
|
color: context.colors.textSecondary,
|
|
126
|
fontSize: 12,
|
135
|
fontSize: 12,
|
|
@@ -174,6 +183,8 @@ class TodayActivityCard extends StatelessWidget { |
|
@@ -174,6 +183,8 @@ class TodayActivityCard extends StatelessWidget { |
|
174
|
@override
|
183
|
@override
|
|
175
|
Widget build(BuildContext context) {
|
184
|
Widget build(BuildContext context) {
|
|
176
|
final l10n = context.l10n;
|
185
|
final l10n = context.l10n;
|
|
|
|
186
|
+ final isGlobal =
|
|
|
|
187
|
+ controller.environmentConfig.region.value == AppRegion.global;
|
|
177
|
return GestureDetector(
|
188
|
return GestureDetector(
|
|
178
|
onTap: controller.toTrendActivityPage,
|
189
|
onTap: controller.toTrendActivityPage,
|
|
179
|
child: Obx(() {
|
190
|
child: Obx(() {
|
|
@@ -184,7 +195,9 @@ class TodayActivityCard extends StatelessWidget { |
|
@@ -184,7 +195,9 @@ class TodayActivityCard extends StatelessWidget { |
|
184
|
var exercise = healthData?.exercise ?? 0;
|
195
|
var exercise = healthData?.exercise ?? 0;
|
|
185
|
|
196
|
|
|
186
|
var activityStr = (activity > 0 && (activityTarget?.move ?? 0) > 0)
|
197
|
var activityStr = (activity > 0 && (activityTarget?.move ?? 0) > 0)
|
|
187
|
- ? '$activity'
|
198
|
+ ? isGlobal
|
|
|
|
199
|
+ ? '$activity '
|
|
|
|
200
|
+ : '$activity'
|
|
188
|
: '-';
|
201
|
: '-';
|
|
189
|
// exercise 单位为秒,转换为小时+分钟
|
202
|
// exercise 单位为秒,转换为小时+分钟
|
|
190
|
Widget exerciseWidget;
|
203
|
Widget exerciseWidget;
|
|
@@ -198,9 +211,10 @@ class TodayActivityCard extends StatelessWidget { |
|
@@ -198,9 +211,10 @@ class TodayActivityCard extends StatelessWidget { |
|
198
|
fontWeight: FontWeight.w600,
|
211
|
fontWeight: FontWeight.w600,
|
|
199
|
),
|
212
|
),
|
|
200
|
children: [
|
213
|
children: [
|
|
201
|
- TextSpan(text: '$exTotalMinutes'),
|
|
|
|
202
|
TextSpan(
|
214
|
TextSpan(
|
|
203
|
- text: l10n.reportUnitMinute,
|
215
|
+ text: isGlobal ? '$exTotalMinutes ' : '$exTotalMinutes'),
|
|
|
|
216
|
+ TextSpan(
|
|
|
|
217
|
+ text: l10n.activityUnitMinute,
|
|
204
|
style: TextStyle(
|
218
|
style: TextStyle(
|
|
205
|
color: context.colors.textSecondary,
|
219
|
color: context.colors.textSecondary,
|
|
206
|
fontSize: 12,
|
220
|
fontSize: 12,
|
|
@@ -236,9 +250,9 @@ class TodayActivityCard extends StatelessWidget { |
|
@@ -236,9 +250,9 @@ class TodayActivityCard extends StatelessWidget { |
|
236
|
fontWeight: FontWeight.w600,
|
250
|
fontWeight: FontWeight.w600,
|
|
237
|
),
|
251
|
),
|
|
238
|
children: [
|
252
|
children: [
|
|
239
|
- TextSpan(text: '$stand'),
|
253
|
+ TextSpan(text: isGlobal ? '$stand ' : '$stand'),
|
|
240
|
TextSpan(
|
254
|
TextSpan(
|
|
241
|
- text: l10n.reportUnitHour,
|
255
|
+ text: l10n.activityUnitHour,
|
|
242
|
style: TextStyle(
|
256
|
style: TextStyle(
|
|
243
|
color: context.colors.textSecondary,
|
257
|
color: context.colors.textSecondary,
|
|
244
|
fontSize: 12,
|
258
|
fontSize: 12,
|