更新语言

This commit is contained in:
wyf
2025-12-09 18:09:31 +08:00
parent e7c51bea52
commit 793dddfba8
7 changed files with 71 additions and 38 deletions

View File

@@ -612,5 +612,7 @@
"去绑定": "Go Bind", "去绑定": "Go Bind",
"解除分享": "Unshare", "解除分享": "Unshare",
"详情": "Detail", "详情": "Detail",
"更新成功": "Update Success" "更新成功": "Update Success",
"原邮箱号": "Original Email",
"请输入邮箱号":"Please enter email"
} }

View File

@@ -611,5 +611,9 @@
"允许对方配置wifi": "允许对方配置wifi", "允许对方配置wifi": "允许对方配置wifi",
"去绑定": "去绑定", "去绑定": "去绑定",
"解除分享": "解除分享", "解除分享": "解除分享",
"详情": "详情" "详情": "详情",
"原邮箱号": "原邮箱号",
"用户拒绝授权": "用户拒绝授权",
"用户取消授权": "用户取消授权",
"请输入邮箱号":"请输入邮箱号"
} }

View File

@@ -608,5 +608,9 @@
"去绑定": "去綁定", "去绑定": "去綁定",
"解除分享": "解除分享", "解除分享": "解除分享",
"详情": "詳情", "详情": "詳情",
"更新成功": "更新成功" "更新成功": "更新成功",
"原邮箱号": "原郵箱號",
"用户拒绝授权": "用戶拒絕授權",
"用户取消授权": "用戶取消授權",
"请输入邮箱号":"請輸入郵箱號"
} }

View File

@@ -155,6 +155,7 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
apiResponse.msg = "昵称为空".tr; apiResponse.msg = "昵称为空".tr;
return apiResponse; return apiResponse;
} }
if ((phone != null && phone.isNotEmpty) || if ((phone != null && phone.isNotEmpty) ||
(email != null && email.isNotEmpty)) { (email != null && email.isNotEmpty)) {
if (loginController.model.updateCode == null || if (loginController.model.updateCode == null ||

View File

@@ -35,6 +35,41 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
super.dispose(); super.dispose();
} }
// 计算y轴的最大最小值
(double, double) _calculateYMinMax(List<TimeSeriesPoint> dataPoints) {
if (dataPoints.isEmpty) {
return (8.0, 20.0);
}
// 过滤掉无效数据点(值为-1的
final validPoints = dataPoints.where((point) => point.value >= 0).toList();
if (validPoints.isEmpty) {
return (8.0, 20.0);
}
// 找出数据中的实际最小值和最大值
double dataMin = validPoints.map((point) => point.value).reduce((a, b) => a < b ? a : b);
double dataMax = validPoints.map((point) => point.value).reduce((a, b) => a > b ? a : b);
// 设置默认范围
double yMin = 8.0;
double yMax = 20.0;
// 如果数据范围超出了默认范围,则调整
if (dataMin < yMin) {
// 最小值为0不能为负数且向下浮动2
yMin = (dataMin - 2).clamp(0.0, double.infinity);
}
if (dataMax > yMax) {
// 向上浮动2
yMax = dataMax + 2;
}
return (yMin, yMax);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
try { try {
@@ -54,41 +89,35 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
data.forEach((item) { data.forEach((item) {
final x = item['st'] as int; final x = item['st'] as int;
if (item['value'] == null || item['value'] == '') { if (item['value'] == null || item['value'] == '') {
// return;
dataPoints.add(TimeSeriesPoint(x, -1)); dataPoints.add(TimeSeriesPoint(x, -1));
return; return;
} }
final y = (item['value'] as num).toDouble(); // 安全地转换为 double final y = (item['value'] as num).toDouble();
// return TimeSeriesPoint(x, y);
dataPoints.add(TimeSeriesPoint(x, y)); dataPoints.add(TimeSeriesPoint(x, y));
}); });
} }
// 计算动态的y轴范围
final (yMin, yMax) = _calculateYMinMax(dataPoints);
List<Map<String, dynamic>> brs = List<Map<String, dynamic>> brs =
(widget.sleepReport['brs'] as List).cast<Map<String, dynamic>>(); (widget.sleepReport['brs'] as List).cast<Map<String, dynamic>>();
//307 平均呼吸
//305 基准呼吸
//308 最低呼吸
//309 最高呼吸
// 307 平均呼吸
Map<String, dynamic>? avgBreath = brs.firstWhere( Map<String, dynamic>? avgBreath = brs.firstWhere(
(element) => element['id'] == 307, (element) => element['id'] == 307,
orElse: () => {}, orElse: () => {},
); );
// 305 基准呼吸
Map<String, dynamic>? baseBreath = brs.firstWhere( Map<String, dynamic>? baseBreath = brs.firstWhere(
(element) => element['id'] == 305, (element) => element['id'] == 305,
orElse: () => {}, orElse: () => {},
); );
// 308 最低呼吸
Map<String, dynamic>? minBreath = brs.firstWhere( Map<String, dynamic>? minBreath = brs.firstWhere(
(element) => element['id'] == 308, (element) => element['id'] == 308,
orElse: () => {}, orElse: () => {},
); );
// 309 最高呼吸
Map<String, dynamic>? maxBreath = brs.firstWhere( Map<String, dynamic>? maxBreath = brs.firstWhere(
(element) => element['id'] == 309, (element) => element['id'] == 309,
orElse: () => {}, orElse: () => {},
@@ -111,7 +140,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: themeController.currentColor.sc5, color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius), // 你可以按需调整圆角半径 AppConstants().normal_container_radius),
), ),
child: Padding( child: Padding(
padding: padding:
@@ -131,10 +160,10 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
highlightColor: Colors.white, // 或设置为你需要的水波纹颜色 highlightColor: Colors.white,
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
14.rpx, 10.rpx, 14.rpx, 10.rpx), // 14.rpx, 10.rpx, 14.rpx, 10.rpx),
borderRadius: 0.rpx, // 圆形点击区域 borderRadius: 0.rpx,
onTap: () { onTap: () {
if (AppConstants().ent_type == if (AppConstants().ent_type ==
APPPackageType.MHT.code) { APPPackageType.MHT.code) {
@@ -142,7 +171,6 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
context, context,
Container( Container(
child: Text( child: Text(
// "呼吸数据介绍".tr,
"呼吸数据是指用户在睡眠过程中呼吸的基本数据,是评估睡眠呼吸质量、筛查睡眠呼吸障碍的核心指标。" "呼吸数据是指用户在睡眠过程中呼吸的基本数据,是评估睡眠呼吸质量、筛查睡眠呼吸障碍的核心指标。"
.tr, .tr,
style: TextStyle( style: TextStyle(
@@ -178,7 +206,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
}, },
child: Container( child: Container(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部 0, 0.rpx, 0.rpx, 0),
width: 28.rpx, width: 28.rpx,
height: 28.rpx, height: 28.rpx,
child: SvgPicture.asset( child: SvgPicture.asset(
@@ -202,39 +230,33 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
// 圆形小球容器
Container( Container(
width: 14.rpx, // 圆球的直径 width: 14.rpx,
height: 14.rpx, height: 14.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
color: themeController.currentColor.sc2, // 小球的颜色 color: themeController.currentColor.sc2,
shape: BoxShape.circle, // 设置为圆形 shape: BoxShape.circle,
), ),
), ),
SizedBox(width: 15.rpx), // 圆球和文字之间的间隔 SizedBox(width: 15.rpx),
// 文字
Text( Text(
'正常范围'.tr + "${range}", '正常范围'.tr + "${range}",
style: TextStyle( style: TextStyle(
fontSize: fontSize:
AppConstants().smaller_text_fontSize, // 文字的大小 AppConstants().smaller_text_fontSize,
color: themeController.currentColor.sc3, // 文字颜色 color: themeController.currentColor.sc3,
), ),
), ),
], ],
), ),
Container( Container(
// color: Colors.red,
width: double.infinity, width: double.infinity,
// height: 300.rpx,
child: TimeSeriesChart( child: TimeSeriesChart(
startTime: startTime, startTime: startTime,
endTime: endTime, endTime: endTime,
yMin: 8, yMin: yMin,
yMax: 20, yMax: yMax,
dataPoints: dataPoints, dataPoints: dataPoints,
// actYMax: max.toDouble(),
// actYMin: min.toDouble(),
), ),
), ),
].divide(SizedBox( ].divide(SizedBox(

View File

@@ -96,7 +96,7 @@ class _UpdateUserEmailPageState extends State<UpdateUserEmailPage> {
if (loginController.model.updatePhone == null || if (loginController.model.updatePhone == null ||
loginController.model.updatePhone == '') { loginController.model.updatePhone == '') {
NewTopSlideNotification.show( NewTopSlideNotification.show(
text: "请输入邮箱号", text: "请输入邮箱号".tr,
textColor: themeController.currentColor.sc9, textColor: themeController.currentColor.sc9,
); );
return; return;

View File

@@ -100,7 +100,7 @@ class _UpdateUserTelPageState extends State<UpdateUserTelPage> {
if (loginController.model.updatePhone == null || if (loginController.model.updatePhone == null ||
loginController.model.updatePhone == '') { loginController.model.updatePhone == '') {
NewTopSlideNotification.show( NewTopSlideNotification.show(
text: "请输入手机号", text: "请输入手机号".tr,
textColor: themeController.currentColor.sc9, textColor: themeController.currentColor.sc9,
); );
return; return;
@@ -183,7 +183,7 @@ class _UpdateUserTelPageState extends State<UpdateUserTelPage> {
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
60.rpx, 0, 35.rpx, 0), 60.rpx, 0, 35.rpx, 0),
child: Text( child: Text(
"原手机号码" + ":" + "${getHidePhone()}", "原手机号码".tr + ":" + "${getHidePhone()}",
style: TextStyle( style: TextStyle(
color: themeController.currentColor.sc3, color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize, fontSize: AppConstants().normal_text_fontSize,