更新法语语言包

This commit is contained in:
wyf
2026-01-31 14:43:47 +08:00
parent 2aedbb3d74
commit 97ffc1220d
48 changed files with 1608 additions and 1837 deletions

View File

@@ -40,33 +40,35 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
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 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);
}
@@ -102,7 +104,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
List<Map<String, dynamic>> brs =
(widget.sleepReport['brs'] as List).cast<Map<String, dynamic>>();
Map<String, dynamic>? avgBreath = brs.firstWhere(
(element) => element['id'] == 307,
orElse: () => {},
@@ -139,8 +141,8 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
borderRadius:
BorderRadius.circular(AppConstants().normal_container_radius),
),
child: Padding(
padding:
@@ -205,8 +207,8 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
}
},
child: Container(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0.rpx, 0),
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0.rpx, 0),
width: 28.rpx,
height: 28.rpx,
child: SvgPicture.asset(
@@ -242,8 +244,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
Text(
'正常范围'.tr + "${range}",
style: TextStyle(
fontSize:
AppConstants().smaller_text_fontSize,
fontSize: AppConstants().smaller_text_fontSize,
color: themeController.currentColor.sc3,
),
),
@@ -264,150 +265,162 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
)),
),
),
// Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 0.rpx, 0.rpx),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: [
// Column(
// children: [
// Text(
// "${avgBreath['name']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().normal_text_fontSize),
// ),
// Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Text(
// "${avgBreath['value']}",
// style: TextStyle(
// color: themeController.currentColor.sc2,
// fontSize:
// AppConstants().normal_text_fontSize),
// ),
// Text(
// "${avgBreath['unit']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().small_text_fontSize),
// ),
// ].divide(SizedBox(
// width: 6.rpx,
// )),
// ),
// ],
// ),
// Column(
// children: [
// Text(
// "${baseBreath['name']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().normal_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Text(
// "${baseBreath['value']}",
// style: TextStyle(
// color: themeController.currentColor.sc2,
// fontSize:
// AppConstants().normal_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Text(
// "${baseBreath['unit']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().small_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// ].divide(SizedBox(
// width: 6.rpx,
// )),
// ),
// ],
// ),
// Column(
// children: [
// Text(
// "${minBreath['name']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().normal_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Text(
// "${minBreath['value']}",
// style: TextStyle(
// color: themeController.currentColor.sc2,
// fontSize:
// AppConstants().normal_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Text(
// "${minBreath['unit']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().small_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// ].divide(SizedBox(
// width: 6.rpx,
// )),
// ),
// ],
// ),
// Column(
// children: [
// Text(
// "${maxBreath['name']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().normal_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Text(
// "${maxBreath['value']}",
// style: TextStyle(
// color: themeController.currentColor.sc2,
// fontSize:
// AppConstants().normal_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Text(
// "${maxBreath['unit']}",
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontSize: AppConstants().small_text_fontSize),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// ].divide(SizedBox(
// width: 6.rpx,
// )),
// ),
// ],
// ),
// ],
// ),
// ),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 0.rpx, 0.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
children: [
Text(
"${avgBreath['name']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize),
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${avgBreath['value']}",
style: TextStyle(
color: themeController.currentColor.sc2,
fontSize:
AppConstants().normal_text_fontSize),
),
Text(
"${avgBreath['unit']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().small_text_fontSize),
),
].divide(SizedBox(
width: 6.rpx,
)),
),
],
),
Column(
children: [
Text(
"${baseBreath['name']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${baseBreath['value']}",
style: TextStyle(
color: themeController.currentColor.sc2,
fontSize:
AppConstants().normal_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
"${baseBreath['unit']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().small_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
].divide(SizedBox(
width: 6.rpx,
)),
),
],
),
Column(
children: [
Text(
"${minBreath['name']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${minBreath['value']}",
style: TextStyle(
color: themeController.currentColor.sc2,
fontSize:
AppConstants().normal_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
"${minBreath['unit']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().small_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
].divide(SizedBox(
width: 6.rpx,
)),
),
],
),
Column(
children: [
Text(
"${maxBreath['name']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${maxBreath['value']}",
style: TextStyle(
color: themeController.currentColor.sc2,
fontSize:
AppConstants().normal_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
"${maxBreath['unit']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().small_text_fontSize),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
].divide(SizedBox(
width: 6.rpx,
)),
),
],
),
_buildBreathItem(avgBreath),
_buildBreathItem(baseBreath),
_buildBreathItem(minBreath),
_buildBreathItem(maxBreath),
],
),
),
@@ -420,4 +433,70 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
return Container();
}
}
}
Widget _buildBreathItem(Map<String, dynamic> data) {
return Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 4.rpx, vertical: 4.rpx),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// 名称 - 最多2行
Flexible(
child: Text(
"${data['name']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
),
SizedBox(height: 4.rpx),
// 值 + 单位 - 最多2行
Flexible(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
fit: FlexFit.loose,
child: Text(
"${data['value']}",
style: TextStyle(
color: themeController.currentColor.sc2,
fontSize: AppConstants().normal_text_fontSize,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
),
SizedBox(width: 4.rpx),
Flexible(
fit: FlexFit.loose,
child: Text(
"${data['unit']}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().small_text_fontSize,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
),
],
),
),
],
),
),
);
}
}