|
...
|
...
|
@@ -467,32 +467,26 @@ class _TrendMetric extends StatelessWidget { |
|
|
|
}
|
|
|
|
|
|
|
|
String _weekComparisonText(BuildContext context, int difference) {
|
|
|
|
final isZh = Localizations.localeOf(context).languageCode == 'zh';
|
|
|
|
return difference == 0
|
|
|
|
? (isZh ? '与上周一致' : 'Same as last week')
|
|
|
|
? context.l10n.hrvSameAsLastWeek
|
|
|
|
: difference > 0
|
|
|
|
? context.l10n.hrvMoreDaysThanLastWeek(difference)
|
|
|
|
: context.l10n.hrvFewerDaysThanLastWeek(difference.abs());
|
|
|
|
}
|
|
|
|
|
|
|
|
String _monthComparisonText(BuildContext context, int difference) {
|
|
|
|
final isZh = Localizations.localeOf(context).languageCode == 'zh';
|
|
|
|
if (difference == 0) {
|
|
|
|
return isZh ? '与上月一致' : 'Same as last month';
|
|
|
|
return context.l10n.hrvSameAsLastMonth;
|
|
|
|
}
|
|
|
|
if (difference > 0) {
|
|
|
|
return isZh
|
|
|
|
? '比上月多$difference天'
|
|
|
|
: '$difference more days than last month';
|
|
|
|
return context.l10n.hrvMoreDaysThanLastMonth(difference);
|
|
|
|
}
|
|
|
|
final count = difference.abs();
|
|
|
|
return isZh ? '比上月少$count天' : '$count fewer days than last month';
|
|
|
|
return context.l10n.hrvFewerDaysThanLastMonth(difference.abs());
|
|
|
|
}
|
|
|
|
|
|
|
|
String _unavailableComparisonText(BuildContext context) {
|
|
|
|
if (!isMonth) return context.l10n.hrvComparedLastWeekUnavailable;
|
|
|
|
final isZh = Localizations.localeOf(context).languageCode == 'zh';
|
|
|
|
return isZh ? '比上月少-天' : 'Compared with last month: -';
|
|
|
|
return context.l10n.hrvComparedLastMonthUnavailable;
|
|
|
|
}
|
|
|
|
|
|
|
|
Color _comparisonColor(int? difference) {
|
|
...
|
...
|
@@ -518,13 +512,19 @@ class _StressAxisLabels extends StatelessWidget { |
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return const SizedBox(
|
|
|
|
return SizedBox(
|
|
|
|
width: 14,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
RotatedBox(quarterTurns: 1, child: _StressAxisText('轻松')),
|
|
|
|
RotatedBox(quarterTurns: 1, child: _StressAxisText('压力大')),
|
|
|
|
RotatedBox(
|
|
|
|
quarterTurns: 1,
|
|
|
|
child: _StressAxisText(context.l10n.hrvRelaxedAxisLabel),
|
|
|
|
),
|
|
|
|
RotatedBox(
|
|
|
|
quarterTurns: 1,
|
|
|
|
child: _StressAxisText(context.l10n.hrvStressedAxisLabel),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
...
|
...
|
@@ -644,91 +644,91 @@ class _DistributionCard extends StatelessWidget { |
|
|
|
final HrvPeriodReport report;
|
|
|
|
final bool showExample;
|
|
|
|
final VoidCallback? onTap;
|
|
|
|
static const _cardHeight = 425.0;
|
|
|
|
static const _barRight = 45.0;
|
|
|
|
static const _barRight = 25.0;
|
|
|
|
static const _barWidth = 42.0;
|
|
|
|
static const _barHeight = 220.0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return _Card(
|
|
|
|
onTap: onTap,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
child: ConstrainedBox(
|
|
|
|
constraints: const BoxConstraints(minHeight: _cardHeight),
|
|
|
|
child: Stack(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(20, 20, 20, 24),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(20, 20, 20, 24),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
_ReportTitle(
|
|
|
|
title: HealthReportSubjectScope.titleOf(
|
|
|
|
context,
|
|
|
|
context.l10n.hrvStressDistribution,
|
|
|
|
),
|
|
|
|
showExample: showExample,
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
Text(
|
|
|
|
context.l10n.hrvValidDays,
|
|
|
|
style: const TextStyle(
|
|
|
|
color: Color(0xFF78787D),
|
|
|
|
fontSize: 12,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
_ValueWithUnit(
|
|
|
|
value: '${report.validDays}',
|
|
|
|
unit: context.l10n.reportUnitDay,
|
|
|
|
),
|
|
|
|
const SizedBox(height: 28),
|
|
|
|
SizedBox(
|
|
|
|
width: 216,
|
|
|
|
child: _DistributionGrid(report: report),
|
|
|
|
_topView(context),
|
|
|
|
const Divider(height: 1, color: Color(0xFFF3F3F3)),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: _ExtremeHrv(
|
|
|
|
title: context.l10n.hrvLowest,
|
|
|
|
day: report.minDay,
|
|
|
|
),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
const Divider(height: 1, color: Color(0xFFF3F3F3)),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: _ExtremeHrv(
|
|
|
|
title: context.l10n.hrvLowest,
|
|
|
|
day: report.minDay,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: _ExtremeHrv(
|
|
|
|
title: context.l10n.hrvHighest,
|
|
|
|
day: report.maxDay,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: _ExtremeHrv(
|
|
|
|
title: context.l10n.hrvHighest,
|
|
|
|
day: report.maxDay,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _topView(BuildContext context) {
|
|
|
|
return Stack(
|
|
|
|
children: [
|
|
|
|
Positioned(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
_ReportTitle(
|
|
|
|
title: HealthReportSubjectScope.titleOf(
|
|
|
|
context,
|
|
|
|
context.l10n.hrvStressDistribution,
|
|
|
|
),
|
|
|
|
showExample: showExample,
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
|
|
right: _barRight,
|
|
|
|
width: _barWidth,
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
padding: EdgeInsets.only(top: 50.h),
|
|
|
|
child: SizedBox(
|
|
|
|
height: _barHeight,
|
|
|
|
child: IgnorePointer(
|
|
|
|
child: _DistributionBar(report: report),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
Text(
|
|
|
|
context.l10n.hrvValidDays,
|
|
|
|
style: const TextStyle(
|
|
|
|
color: Color(0xFF78787D),
|
|
|
|
fontSize: 12,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
_ValueWithUnit(
|
|
|
|
value: '${report.validDays}',
|
|
|
|
unit: context.l10n.reportUnitDay,
|
|
|
|
),
|
|
|
|
const SizedBox(height: 28),
|
|
|
|
SizedBox(
|
|
|
|
width: 216,
|
|
|
|
child: _DistributionGrid(report: report),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
|
|
width: _barWidth,
|
|
|
|
right: _barRight,
|
|
|
|
bottom: 25.h,
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
padding: EdgeInsets.only(top: 25.h),
|
|
|
|
child: IgnorePointer(child: _DistributionBar(report: report))),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -859,7 +859,9 @@ class _ExtremeHrv extends StatelessWidget { |
|
|
|
unit: 'ms'),
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
Text(
|
|
|
|
day == null ? '-月-日' : reportMonthDay(day!.date),
|
|
|
|
day == null
|
|
|
|
? context.l10n.hrvEmptyMonthDayPlaceholder
|
|
|
|
: reportMonthDay(day!.date),
|
|
|
|
style: const TextStyle(color: Color(0xFF78787D), fontSize: 12),
|
|
|
|
),
|
|
|
|
],
|
...
|
...
|
|