更新睡眠报告

This commit is contained in:
wyf
2025-05-29 20:20:49 +08:00
parent b34737dbe8
commit 7a816922fa
41 changed files with 4604 additions and 2394 deletions

View File

@@ -79,156 +79,181 @@ class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
showTipDialog(
backgroundColor: stringToColor("#FFFFFF"),
context,
Column(
children: [
Text(
"${widget.data['name']}",
style: TextStyle(
color: stringToColor("#333333"),
fontSize: 36.rpx,
),
),
SizedBox(
height: 17.rpx,
),
Text(
(widget.data['tips']?.toString().trim().isNotEmpty ?? false)
? widget.data['tips'].toString()
: "未知数据".tr,
style: TextStyle(
color: stringToColor("#C8CBD2"),
fontSize: 26.rpx,
),
),
SizedBox(
height: 37.rpx,
),
Text(
"${widget.data['value']}",
style: TextStyle(
color: stringToColor("${widget.data['color']}"),
fontSize: 60.rpx,
),
),
SizedBox(
height: 81.rpx,
),
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
for (int i = 0; i < levelGroups.length; i++) ...[
// 每个 levelGroup 区域
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// Level 名称
Text(
levelGroups[i]['levelName'],
style: TextStyle(
fontSize: 30.rpx,
color: stringToColor("#333333"),
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 38.rpx),
Container(
constraints: BoxConstraints(
maxHeight: 700.rpx,
),
child: SingleChildScrollView(
child: Column(
children: [
Text(
"${widget.data['name']}",
style: TextStyle(
color: stringToColor("#333333"),
fontSize: 36.rpx,
),
),
SizedBox(
height: 17.rpx,
),
Text(
(widget.data['tips']?.toString().trim().isNotEmpty ??
false)
? widget.data['tips'].toString()
: "未知数据".tr,
style: TextStyle(
color: stringToColor("#C8CBD2"),
fontSize: 26.rpx,
),
),
SizedBox(
height: 37.rpx,
),
Text(
"${widget.data['value']}" +
((widget.data['unit'] == null ||
widget.data['unit'].toString().isEmpty)
? ''
: widget.data['unit']),
style: TextStyle(
color: stringToColor("${widget.data['color']}"),
fontSize: 60.rpx,
),
),
SizedBox(
height: 81.rpx,
),
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
for (int i = 0; i < levelGroups.length; i++) ...[
// 每个 levelGroup 区域
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// Level 名称
Text(
levelGroups[i]['levelName'],
style: TextStyle(
fontSize: 30.rpx,
color: stringToColor("#333333"),
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 38.rpx),
// 颜色圆点 + key包一层和 svg 分离)
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start, // 上对齐,避免撑高分割线
children:
levelGroups[i]['items'].map<Widget>((item) {
final bool isSelected =
(item['key'] == itemLevel);
return Column(
children: [
// 颜色圆点 + key参与分割线高度
Column(
// 颜色圆点 + key包一层和 svg 分离)
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start, // 上对齐,避免撑高分割线
children: levelGroups[i]['items']
.map<Widget>((item) {
final bool isSelected =
(item['key'] == itemLevel);
return Column(
children: [
Container(
width: 20.rpx,
height: 20.rpx,
decoration: BoxDecoration(
color:
stringToColor(item['color']),
shape: BoxShape.circle,
),
),
SizedBox(height: 30.rpx),
Text(
item['key'],
style: TextStyle(
color: stringToColor("#333333"),
fontSize: 20.rpx,
),
// 颜色圆点 + key参与分割线高度
Column(
children: [
Container(
width: 20.rpx,
height: 20.rpx,
decoration: BoxDecoration(
color: stringToColor(
item['color']),
shape: BoxShape.circle,
),
),
SizedBox(height: 30.rpx),
Text(
item['key'],
style: TextStyle(
color:
stringToColor("#333333"),
fontSize: 20.rpx,
),
),
],
),
// svg 箭头(不影响分割线高度)
SizedBox(height: 20.rpx),
isSelected
? SvgPicture.asset(
'assets/img/icon/triangle.svg',
width: 18.rpx,
height: 18.rpx,
color: themeController
.currentColor.sc9,
)
: SizedBox(height: 18.rpx),
],
),
// svg 箭头(不影响分割线高度)
SizedBox(height: 20.rpx),
isSelected
? SvgPicture.asset(
'assets/img/icon/triangle.svg',
width: 18.rpx,
height: 18.rpx,
color: themeController
.currentColor.sc9,
)
: SizedBox(height: 18.rpx),
],
);
}).toList(),
);
}).toList(),
),
],
),
],
),
),
),
// 分割线(只和主要内容等高)
if (i != levelGroups.length - 1)
Container(
width: 1.rpx,
color: stringToColor("${widget.data['color']}"),
margin: EdgeInsets.symmetric(horizontal: 10.rpx),
// 分割线(只和主要内容等高)
if (i != levelGroups.length - 1)
Container(
width: 1.rpx,
color: Colors.grey.withOpacity(0.5),
margin:
EdgeInsets.symmetric(horizontal: 10.rpx),
),
]
],
),
),
SizedBox(
height: 71.rpx,
),
RichText(
text: TextSpan(
children: [
TextSpan(
text: "当前属于".tr, // 第一部分文本
style: TextStyle(
color: Colors.black, // 你想要的样式
fontSize: 30.rpx,
),
),
]
],
),
),
SizedBox(
height: 71.rpx,
),
RichText(
text: TextSpan(
children: [
TextSpan(
text: "当前属于".tr, // 第一部分文本
style: TextStyle(
color: Colors.black, // 你想要的样式
fontSize: 30.rpx,
),
TextSpan(
text: itemLevel, // 第二部分文本
style: TextStyle(
color: stringToColor("${widget.data['color']}"),
fontSize: 30.rpx,
),
),
],
),
TextSpan(
text: itemLevel, // 第二部分文本
style: TextStyle(
color: stringToColor("${widget.data['color']}"),
fontSize: 30.rpx,
),
),
],
),
),
],
),
],
),
),
);
}
if (widget.data['onto'] != null && widget.data['onto'] == true) {
//跳转睡眠报告
Get.toNamed("/newSleepReportPage", arguments: {
'date': widget.data['time'] != null
? int.parse(widget.data['time'].toString())
: DateTime.now().millisecondsSinceEpoch,
"mac": 'aaaaaaeeeeeq',
'type': 1,
'name': 'sleep', //'sleep', 'heartRate' 或 'breathe'
'itemName': widget.data['id'],
});
}
},
child: Container(
// width: MediaQuery.sizeOf(context).width * 0.267,
width: MediaQuery.sizeOf(context).width * 0.267,
constraints: BoxConstraints(
minWidth: 200.rpx,
@@ -251,40 +276,80 @@ class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
overflow: TextOverflow.ellipsis,
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'${widget.data['value']}',
style: FlutterFlowTheme.of(context).bodyMedium.override(
// Expanded(
// child: Row(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Text(
// '${widget.data['value']}',
// style: FlutterFlowTheme.of(context).bodyMedium.override(
// fontFamily: 'Inter',
// fontSize: 36.rpx,
// letterSpacing: 0.0,
// color: themeController.currentColor.sc3,
// ),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(0, 0, 0, 10.rpx),
// child: Text(
// '${widget.data['unit'] ?? ''}',
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: AppConstants().small_text_fontSize,
// letterSpacing: 0.0,
// color: themeController.currentColor.sc3,
// ),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// ),
// ],
// ),
// ),
Expanded(
child: Text.rich(
TextSpan(
children: [
TextSpan(
text: '${widget.data['value']}',
style: TextStyle(
fontFamily: 'Inter',
fontSize: 36.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
WidgetSpan(child: SizedBox(width: 2.rpx)), // 可选间距
TextSpan(
text: widget.data['unit'] != null
? '${widget.data['unit']}'
: '',
style: TextStyle(
fontFamily: 'Inter',
fontSize: AppConstants().small_text_fontSize,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
],
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 10.rpx),
child: Text(
'${widget.data['unit'] ?? ''}',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: AppConstants().small_text_fontSize,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
maxLines: 1,
style: TextStyle(
color:
themeController.currentColor.sc3), // 强制 ellipsis 颜色
overflow: TextOverflow.ellipsis,
),
),
if (widget.data['level'] != null)
ClickableContainer(
backgroundColor: (widget.data['color'] == null ||