多语言
This commit is contained in:
@@ -115,28 +115,28 @@ class _HeartChangeWidgetState extends State<HeartChangeWidget> {
|
||||
DataShowWidget(
|
||||
alignment: MainAxisAlignment.center,
|
||||
widget1: Text(
|
||||
"名称",
|
||||
"名称".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
widget2: Text(
|
||||
"测量值",
|
||||
"测量值".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
widget3: Text(
|
||||
"参考范围",
|
||||
"参考范围".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
widget4: Text(
|
||||
"趋势",
|
||||
"趋势".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:ef/base/chart/drawer.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/component/easychart.dart';
|
||||
@@ -19,11 +20,11 @@ Widget MonthDataWidget(
|
||||
return [
|
||||
AvgSleepScoreWidget(
|
||||
sleepReport: sleepReport,
|
||||
mediumLabel: "本月平均分",
|
||||
mediumLabel: "本月平均分".tr,
|
||||
), //睡眠评分
|
||||
SleepChartContainer(
|
||||
title: "每日得分",
|
||||
tipText: "用户本月睡眠分数的汇总。",
|
||||
title: "每日得分".tr,
|
||||
tipText: "用户本月睡眠分数的汇总。".tr,
|
||||
sleepReport: sleepReport,
|
||||
chartContent: LineView(
|
||||
xLabels: [
|
||||
@@ -75,7 +76,7 @@ Widget MonthDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['scoreList']['data'], '分', 1),
|
||||
tips: buildValueTexts(sleepReport['scoreList']['data'], '分'.tr, 1),
|
||||
xCount: buildMonthlyChartData(sleepReport['scoreList'])['daysInMonth']
|
||||
.toInt(),
|
||||
yCount: sleepReport['scoreList']['yLable'].length,
|
||||
@@ -92,9 +93,9 @@ Widget MonthDataWidget(
|
||||
highlightItem: data['itemName'],
|
||||
),
|
||||
IndicatorCompareCard(
|
||||
title: "与上月对比",
|
||||
headers: ["名称", "上月", "本月", "参考范围"],
|
||||
tooltip: "睡眠分数与上月分数进行对比,是通过量化分析近期睡眠质量变化,可了解自身睡眠状态的波动情况,进而调整用户的作息习惯。",
|
||||
title: "与上月对比".tr,
|
||||
headers: ["名称".tr, "上月".tr, "本月".tr, "参考范围".tr],
|
||||
tooltip: "睡眠分数与上月分数进行对比,是通过量化分析近期睡眠质量变化,可了解自身睡眠状态的波动情况,进而调整用户的作息习惯。".tr,
|
||||
rows: (sleepReport['cwl'] ?? []).map<List<Widget>>((item) {
|
||||
return [
|
||||
Text(
|
||||
@@ -120,8 +121,8 @@ Widget MonthDataWidget(
|
||||
}).toList(),
|
||||
),
|
||||
SleepChartContainer(
|
||||
title: "本月睡眠时长",
|
||||
tipText: "本月睡眠时长是指从月初到月末,用户每天实际睡眠的时间总和。",
|
||||
title: "本月睡眠时长".tr,
|
||||
tipText: "本月睡眠时长是指从月初到月末,用户每天实际睡眠的时间总和".tr,
|
||||
sleepReport: sleepReport,
|
||||
chartContent: LineView(
|
||||
xLabels: [
|
||||
@@ -172,7 +173,14 @@ Widget MonthDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildSleepValueTexts(sleepReport['csd']['data'], '小时', 1),
|
||||
tips: buildSleepValueTexts(
|
||||
sleepReport['csd']['data'],
|
||||
'小时'.tr,
|
||||
1,
|
||||
sleepDurationLabel: 'sleep_duration'.tr,
|
||||
deepSleepLabel: 'deep_sleep'.tr,
|
||||
lightSleepLabel: 'light_sleep'.tr,
|
||||
),
|
||||
xCount: buildMonthlyChartData(sleepReport['scoreList'])['daysInMonth']
|
||||
.toInt(),
|
||||
yCount: sleepReport['csd']['yLable'].length,
|
||||
@@ -239,7 +247,8 @@ Widget MonthDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][0]['value'], '入睡时间:', 0),
|
||||
tips:
|
||||
buildValueTexts(sleepReport['dysp'][0]['value'], '入睡时间:'.tr, 0),
|
||||
xCount:
|
||||
buildMonthlyChartData(sleepReport['scoreList'])['daysInMonth']
|
||||
.toInt(),
|
||||
@@ -305,7 +314,8 @@ Widget MonthDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][1]['value'], '起床时间:', 0),
|
||||
tips:
|
||||
buildValueTexts(sleepReport['dysp'][1]['value'], '起床时间:'.tr, 0),
|
||||
xCount:
|
||||
buildMonthlyChartData(sleepReport['scoreList'])['daysInMonth']
|
||||
.toInt(),
|
||||
@@ -371,7 +381,7 @@ Widget MonthDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][2]['value'], '次', 1),
|
||||
tips: buildValueTexts(sleepReport['dysp'][2]['value'], '次'.tr, 1),
|
||||
xCount:
|
||||
buildMonthlyChartData(sleepReport['scoreList'])['daysInMonth']
|
||||
.toInt(),
|
||||
@@ -437,7 +447,7 @@ Widget MonthDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][3]['value'], '毫秒', 1),
|
||||
tips: buildValueTexts(sleepReport['dysp'][3]['value'], '毫秒'.tr, 1),
|
||||
xCount:
|
||||
buildMonthlyChartData(sleepReport['scoreList'])['daysInMonth']
|
||||
.toInt(),
|
||||
@@ -503,7 +513,7 @@ Widget MonthDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][4]['value'], '次/分', 1),
|
||||
tips: buildValueTexts(sleepReport['dysp'][4]['value'], '次/分'.tr, 1),
|
||||
xCount:
|
||||
buildMonthlyChartData(sleepReport['scoreList'])['daysInMonth']
|
||||
.toInt(),
|
||||
@@ -561,10 +571,10 @@ List<String> buildValueTexts(
|
||||
}
|
||||
|
||||
List<String> buildSleepValueTexts(
|
||||
List<dynamic> data,
|
||||
String unit,
|
||||
int direction, // 0 左侧,1 右侧
|
||||
) {
|
||||
List<dynamic> data, String unit, int direction, // 0 左侧,1 右侧
|
||||
{required String sleepDurationLabel,
|
||||
required String deepSleepLabel,
|
||||
required String lightSleepLabel}) {
|
||||
if (data.isEmpty) return [];
|
||||
|
||||
return data.map((item) {
|
||||
@@ -575,22 +585,13 @@ List<String> buildSleepValueTexts(
|
||||
final prefix = direction == 1 ? '' : unit;
|
||||
final suffix = direction == 1 ? unit : '';
|
||||
|
||||
// 格式化日期(不带时间)
|
||||
String dateStr = '';
|
||||
if (item['st'] != null) {
|
||||
final dt = DateTime.fromMillisecondsSinceEpoch(item['st']);
|
||||
dateStr =
|
||||
"${dt.year}年${dt.month.toString().padLeft(2, '0')}月${dt.day.toString().padLeft(2, '0')}日";
|
||||
}
|
||||
var lines = [
|
||||
'$sleepDurationLabel:$prefix$slt$suffix',
|
||||
'$deepSleepLabel:$prefix$dst$suffix',
|
||||
'$lightSleepLabel:$prefix$lst$suffix',
|
||||
].join('\n');
|
||||
|
||||
var q = [
|
||||
"睡眠时长:$prefix$slt$suffix",
|
||||
"深睡:$prefix$dst$suffix",
|
||||
"浅睡:$prefix$lst$suffix",
|
||||
dateStr,
|
||||
].join("\n");
|
||||
print(q);
|
||||
return q;
|
||||
return lines;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -174,105 +174,7 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
|
||||
],
|
||||
)
|
||||
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// decoration: BoxDecoration(),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Container(
|
||||
// constraints: BoxConstraints(maxWidth: 150.rpx),
|
||||
// child: Text(
|
||||
// '30天平均分'.tr,
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFD3D3D3),
|
||||
// fontSize: 26.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// maxLines: 1,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// '${widget.sleepReport['score']?['avg']}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 48.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(height: 56.rpx)),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(),
|
||||
// child: SegmentedCircleWithCenterWidget(
|
||||
// // segments: [
|
||||
// // SegmentData(color: Colors.red, value: 30),
|
||||
// // SegmentData(color: Colors.green, value: 20),
|
||||
// // SegmentData(color: Colors.blue, value: 40),
|
||||
// // SegmentData(color: Colors.orange, value: 10),
|
||||
// // ],
|
||||
// segments: segments,
|
||||
// strokeWidth: 8,
|
||||
// gapAngle: 8,
|
||||
// centerWidget: Container(
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text(
|
||||
// "睡眠评分".tr,
|
||||
// style: TextStyle(
|
||||
// color: stringToColor("#FFFFFF"),
|
||||
// fontSize:
|
||||
// AppConstants().normal_text_fontSize),
|
||||
// ),
|
||||
// Text(
|
||||
// '${widget.sleepReport['score']?['score']}',
|
||||
// style: TextStyle(
|
||||
// color: stringToColor("#FF9F66"),
|
||||
// fontSize: 100.rpx),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// trend: widget.sleepReport['score']?['trend'],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text(
|
||||
// '睡眠等级'.tr,
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFD3D3D3),
|
||||
// fontSize: 26.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// '${getSleepLevel(widget.sleepReport)}',
|
||||
// style: TextStyle(
|
||||
// color: stringToColor("#FF9F66"),
|
||||
// fontSize: 48.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(height: 56.rpx)),
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(
|
||||
// width: 33.rpx,
|
||||
// )),
|
||||
// ),
|
||||
|
||||
|
||||
),
|
||||
SizedBox(height: 50.rpx),
|
||||
Wrap(
|
||||
|
||||
@@ -98,7 +98,7 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"睡眠规律性是指个体睡眠模式在时间、时长、环境等方面呈现出的稳定性和一致性,是衡量睡眠质量的重要指标之一。",
|
||||
"睡眠规律性是指个体睡眠模式在时间、时长、环境等方面呈现出的稳定性和一致性,是衡量睡眠质量的重要指标之一。".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
@@ -194,7 +194,7 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: "小时",
|
||||
text: "小时".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -210,7 +210,7 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: "分钟",
|
||||
text: "分钟".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:ef/base/chart/drawer.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/component/easychart.dart';
|
||||
@@ -22,8 +23,8 @@ Widget WeekDataWidget(
|
||||
sleepReport: sleepReport,
|
||||
),
|
||||
SleepChartContainer(
|
||||
title: "每日得分",
|
||||
tipText: "用户本周睡眠分数的汇总。",
|
||||
title: "每日得分".tr,
|
||||
tipText: "用户本周睡眠分数的汇总".tr,
|
||||
sleepReport: sleepReport,
|
||||
chartContent: LineView(
|
||||
xLabels: [
|
||||
@@ -51,7 +52,15 @@ Widget WeekDataWidget(
|
||||
min: 0, //最小值0
|
||||
max: 7, //最大值30
|
||||
q: 6, //labels第一个与最后一个的真实距离,也就是30-1 = 29
|
||||
labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
labels: [
|
||||
'周一'.tr,
|
||||
'周二'.tr,
|
||||
'周三'.tr,
|
||||
'周四'.tr,
|
||||
'周五'.tr,
|
||||
'周六'.tr,
|
||||
'周日'.tr
|
||||
],
|
||||
indexs: [0, 1, 2, 3, 4, 5, 6], //每一个标签的对应在X轴的真实位置
|
||||
offset: Offset(0, -50.rpx), //标签相对于原点的偏移,下方60像素位置
|
||||
ondrawer: (canvas, offset, index, label, align, style) {
|
||||
@@ -105,9 +114,9 @@ Widget WeekDataWidget(
|
||||
highlightItem: data['itemName'],
|
||||
),
|
||||
IndicatorCompareCard(
|
||||
title: "与上周对比",
|
||||
headers: ["名称", "上周", "本周", "参考范围"],
|
||||
tooltip: "睡眠分数与上周分数进行对比,是通过量化分析近期睡眠质量变化,可了解自身睡眠状态的波动情况,进而调整用户的作息习惯。",
|
||||
title: "与上周对比".tr,
|
||||
headers: ["名称".tr, "上周".tr, "本周".tr, "参考范围".tr],
|
||||
tooltip: "睡眠分数与上周分数进行对比,是通过量化分析近期睡眠质量变化,可了解自身睡眠状态的波动情况,进而调整用户的作息习惯。".tr,
|
||||
rows: (sleepReport['cwl'] ?? []).map<List<Widget>>((item) {
|
||||
return [
|
||||
Text(
|
||||
@@ -133,8 +142,8 @@ Widget WeekDataWidget(
|
||||
}).toList(),
|
||||
),
|
||||
SleepChartContainer(
|
||||
title: "本周睡眠时长",
|
||||
tipText: "本周睡眠时长是指从周一到周日内,每天实际睡眠的时间总和。",
|
||||
title: "本周睡眠时长".tr,
|
||||
tipText: "本周睡眠时长是指从周一到周日内,每天实际睡眠的时间总和。".tr,
|
||||
sleepReport: sleepReport,
|
||||
chartContent: LineView(
|
||||
xLabels: [
|
||||
@@ -162,7 +171,15 @@ Widget WeekDataWidget(
|
||||
min: 0, //最小值0
|
||||
max: 7, //最大值30
|
||||
q: 6, //labels第一个与最后一个的真实距离,也就是30-1 = 29
|
||||
labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
labels: [
|
||||
'周一'.tr,
|
||||
'周二'.tr,
|
||||
'周三'.tr,
|
||||
'周四'.tr,
|
||||
'周五'.tr,
|
||||
'周六'.tr,
|
||||
'周日'.tr
|
||||
],
|
||||
indexs: [0, 1, 2, 3, 4, 5, 6], //每一个标签的对应在X轴的真实位置
|
||||
offset: Offset(0, -50.rpx), //标签相对于原点的偏移,下方60像素位置
|
||||
ondrawer: (canvas, offset, index, label, align, style) {
|
||||
@@ -204,7 +221,14 @@ Widget WeekDataWidget(
|
||||
dualBarPoints: buildTripleBarData(sleepReport['csd']),
|
||||
displayMode: ChartDisplayMode.dualBar,
|
||||
xUnit: sleepReport['csd']['yUnit'],
|
||||
tips: buildSleepValueTexts(sleepReport['csd']['data'], '小时', 1),
|
||||
tips: buildSleepValueTexts(
|
||||
sleepReport['csd']['data'],
|
||||
'小时'.tr,
|
||||
1,
|
||||
sleepDurationLabel: 'sleep_duration'.tr,
|
||||
deepSleepLabel: 'deep_sleep'.tr,
|
||||
lightSleepLabel: 'light_sleep'.tr,
|
||||
),
|
||||
barWidth: 0.2,
|
||||
),
|
||||
showLabel: sleepReport['csd']['type'],
|
||||
@@ -239,7 +263,15 @@ Widget WeekDataWidget(
|
||||
min: 0, //最小值0
|
||||
max: 7, //最大值30
|
||||
q: 6, //labels第一个与最后一个的真实距离,也就是30-1 = 29
|
||||
labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
labels: [
|
||||
'周一'.tr,
|
||||
'周二'.tr,
|
||||
'周三'.tr,
|
||||
'周四'.tr,
|
||||
'周五'.tr,
|
||||
'周六'.tr,
|
||||
'周日'.tr
|
||||
],
|
||||
indexs: [0, 1, 2, 3, 4, 5, 6], //每一个标签的对应在X轴的真实位置
|
||||
offset: Offset(0, -50.rpx), //标签相对于原点的偏移,下方60像素位置
|
||||
ondrawer: (canvas, offset, index, label, align, style) {
|
||||
@@ -277,7 +309,8 @@ Widget WeekDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][0]['value'], '入睡时间:', 0),
|
||||
tips:
|
||||
buildValueTexts(sleepReport['dysp'][0]['value'], '入睡时间:'.tr, 0),
|
||||
xCount: 7,
|
||||
yCount: sleepReport['dysp'][0]['yLable'].length,
|
||||
points: buildGeneralPoints(sleepReport['dysp'][0]),
|
||||
@@ -317,7 +350,15 @@ Widget WeekDataWidget(
|
||||
min: 0, //最小值0
|
||||
max: 7, //最大值30
|
||||
q: 6, //labels第一个与最后一个的真实距离,也就是30-1 = 29
|
||||
labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
labels: [
|
||||
'周一'.tr,
|
||||
'周二'.tr,
|
||||
'周三'.tr,
|
||||
'周四'.tr,
|
||||
'周五'.tr,
|
||||
'周六'.tr,
|
||||
'周日'.tr
|
||||
],
|
||||
indexs: [0, 1, 2, 3, 4, 5, 6], //每一个标签的对应在X轴的真实位置
|
||||
offset: Offset(0, -50.rpx), //标签相对于原点的偏移,下方60像素位置
|
||||
ondrawer: (canvas, offset, index, label, align, style) {
|
||||
@@ -355,7 +396,8 @@ Widget WeekDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][1]['value'], '起床时间:', 0),
|
||||
tips:
|
||||
buildValueTexts(sleepReport['dysp'][1]['value'], '起床时间:'.tr, 0),
|
||||
xCount: 7,
|
||||
yCount: sleepReport['dysp'][1]['yLable'].length,
|
||||
points: buildGeneralPoints(sleepReport['dysp'][1]),
|
||||
@@ -395,7 +437,15 @@ Widget WeekDataWidget(
|
||||
min: 0, //最小值0
|
||||
max: 7, //最大值30
|
||||
q: 6, //labels第一个与最后一个的真实距离,也就是30-1 = 29
|
||||
labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
labels: [
|
||||
'周一'.tr,
|
||||
'周二'.tr,
|
||||
'周三'.tr,
|
||||
'周四'.tr,
|
||||
'周五'.tr,
|
||||
'周六'.tr,
|
||||
'周日'.tr
|
||||
],
|
||||
indexs: [0, 1, 2, 3, 4, 5, 6], //每一个标签的对应在X轴的真实位置
|
||||
offset: Offset(0, -50.rpx), //标签相对于原点的偏移,下方60像素位置
|
||||
ondrawer: (canvas, offset, index, label, align, style) {
|
||||
@@ -433,7 +483,7 @@ Widget WeekDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][2]['value'], '次', 1),
|
||||
tips: buildValueTexts(sleepReport['dysp'][2]['value'], '次'.tr, 1),
|
||||
xCount: 7,
|
||||
yCount: sleepReport['dysp'][2]['yLable'].length,
|
||||
points: buildGeneralPoints(sleepReport['dysp'][2]),
|
||||
@@ -473,7 +523,15 @@ Widget WeekDataWidget(
|
||||
min: 0, //最小值0
|
||||
max: 7, //最大值30
|
||||
q: 6, //labels第一个与最后一个的真实距离,也就是30-1 = 29
|
||||
labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
labels: [
|
||||
'周一'.tr,
|
||||
'周二'.tr,
|
||||
'周三'.tr,
|
||||
'周四'.tr,
|
||||
'周五'.tr,
|
||||
'周六'.tr,
|
||||
'周日'.tr
|
||||
],
|
||||
indexs: [0, 1, 2, 3, 4, 5, 6], //每一个标签的对应在X轴的真实位置
|
||||
offset: Offset(0, -50.rpx), //标签相对于原点的偏移,下方60像素位置
|
||||
ondrawer: (canvas, offset, index, label, align, style) {
|
||||
@@ -511,7 +569,7 @@ Widget WeekDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][3]['value'], '毫秒', 1),
|
||||
tips: buildValueTexts(sleepReport['dysp'][3]['value'], '毫秒'.tr, 1),
|
||||
xCount: 7,
|
||||
yCount: sleepReport['dysp'][3]['yLable'].length,
|
||||
points: buildGeneralPoints(sleepReport['dysp'][3]),
|
||||
@@ -551,7 +609,15 @@ Widget WeekDataWidget(
|
||||
min: 0, //最小值0
|
||||
max: 7, //最大值30
|
||||
q: 6, //labels第一个与最后一个的真实距离,也就是30-1 = 29
|
||||
labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
labels: [
|
||||
'周一'.tr,
|
||||
'周二'.tr,
|
||||
'周三'.tr,
|
||||
'周四'.tr,
|
||||
'周五'.tr,
|
||||
'周六'.tr,
|
||||
'周日'.tr
|
||||
],
|
||||
indexs: [0, 1, 2, 3, 4, 5, 6], //每一个标签的对应在X轴的真实位置
|
||||
offset: Offset(0, -50.rpx), //标签相对于原点的偏移,下方60像素位置
|
||||
ondrawer: (canvas, offset, index, label, align, style) {
|
||||
@@ -589,7 +655,7 @@ Widget WeekDataWidget(
|
||||
},
|
||||
),
|
||||
],
|
||||
tips: buildValueTexts(sleepReport['dysp'][4]['value'], '次/分', 1),
|
||||
tips: buildValueTexts(sleepReport['dysp'][4]['value'], '次/分'.tr, 1),
|
||||
xCount: 7,
|
||||
yCount: sleepReport['dysp'][4]['yLable'].length,
|
||||
points: buildGeneralPoints(sleepReport['dysp'][4]),
|
||||
@@ -653,10 +719,10 @@ List<String> buildValueTexts(
|
||||
|
||||
//多个关键点标签
|
||||
List<String> buildSleepValueTexts(
|
||||
List<dynamic> data,
|
||||
String unit,
|
||||
int direction, // 0 左侧,1 右侧
|
||||
) {
|
||||
List<dynamic> data, String unit, int direction, // 0 左侧,1 右侧
|
||||
{required String sleepDurationLabel,
|
||||
required String deepSleepLabel,
|
||||
required String lightSleepLabel}) {
|
||||
if (data.isEmpty) return [];
|
||||
|
||||
return data.map((item) {
|
||||
@@ -667,13 +733,13 @@ List<String> buildSleepValueTexts(
|
||||
final prefix = direction == 1 ? '' : unit;
|
||||
final suffix = direction == 1 ? unit : '';
|
||||
|
||||
var q = [
|
||||
"睡眠时长:$prefix$slt$suffix",
|
||||
"深睡:$prefix$dst$suffix",
|
||||
"浅睡:$prefix$lst$suffix",
|
||||
].join("\n");
|
||||
print(q);
|
||||
return q;
|
||||
var lines = [
|
||||
'$sleepDurationLabel:$prefix$slt$suffix',
|
||||
'$deepSleepLabel:$prefix$dst$suffix',
|
||||
'$lightSleepLabel:$prefix$lst$suffix',
|
||||
].join('\n');
|
||||
|
||||
return lines;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class AvgSleepScoreWidget extends StatelessWidget {
|
||||
Key? key,
|
||||
required this.sleepReport,
|
||||
this.leftLabel = '最低分',
|
||||
this.mediumLabel = '本周评分',
|
||||
this.mediumLabel = '本周平均分',
|
||||
this.rightLabel = '最高分',
|
||||
this.unknownText = '未知数据',
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -84,16 +84,20 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
_scrollToTargetComponent(sleepReportController.sleepReport);
|
||||
},
|
||||
onFailure: (res) {
|
||||
if (MainPageBBottomChange.getCurrentIndex() != null) {
|
||||
if (MainPageBBottomChange.getCurrentIndex() == 1) {
|
||||
try {
|
||||
if (MainPageBBottomChange.getCurrentIndex() != null) {
|
||||
if (MainPageBBottomChange.getCurrentIndex() == 1) {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!,
|
||||
textColor: themeController.currentColor.sc9);
|
||||
}
|
||||
} else {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!, textColor: themeController.currentColor.sc9);
|
||||
}
|
||||
} else {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!, textColor: themeController.currentColor.sc9);
|
||||
} catch (e) {
|
||||
e;
|
||||
}
|
||||
|
||||
sleepReportController.sleepReport.value = {};
|
||||
sleepReportController.updateAll();
|
||||
print(res);
|
||||
@@ -144,10 +148,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!, textColor: themeController.currentColor.sc9);
|
||||
}
|
||||
} else {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!, textColor: themeController.currentColor.sc9);
|
||||
}
|
||||
} else {}
|
||||
sleepReportController.sleepReport.value = {};
|
||||
sleepReportController.updateAll();
|
||||
print(res);
|
||||
@@ -441,7 +442,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 32.rpx, 30.rpx, 32.rpx),
|
||||
0.rpx, 32.rpx, 30.rpx, 32.rpx),
|
||||
child: getTimeWidget(),
|
||||
),
|
||||
),
|
||||
@@ -1332,21 +1333,6 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
// ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: themeController.currentColor.sc3,
|
||||
// padding: EdgeInsets.all(10.rpx),
|
||||
// borderRadius: 8.rpx,
|
||||
// onTap: onRightArrowTap,
|
||||
// child: Container(
|
||||
// width: 30.rpx,
|
||||
// height: 30.rpx,
|
||||
// child: SvgPicture.asset(
|
||||
// 'assets/img/icon/arrow_right.svg',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Obx(() => ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc3,
|
||||
@@ -1371,8 +1357,9 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
borderRadius: 8,
|
||||
onTap: () {
|
||||
sleepReportController.model.type == 3
|
||||
? showMonthSelectionDialog(context, checkDate: selectedDate,
|
||||
checkChange: (DateTime d) {
|
||||
? showMonthSelectionDialog(context,
|
||||
checkDate: selectedDate,
|
||||
title: "选择月份".tr, checkChange: (DateTime d) {
|
||||
sleepReportController.selectedDate.value = d;
|
||||
calendarController.selectedDate.value = d;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user