更新样式

This commit is contained in:
wyf
2025-08-27 10:45:33 +08:00
parent 92e92f4db7
commit dc647ea43c
25 changed files with 1569 additions and 619 deletions

View File

@@ -13,6 +13,7 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/date/CalendarController.dart';
import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/language/AppLanguage.dart';
import 'package:vbvs_app/pages/common/selectDialog.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
@@ -113,7 +114,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
_initSleepReportData();
});
double lineWidth = 115.rpx;
double lineWidth = 150.rpx;
return LayoutBuilder(
builder: (context, bodySize) => GestureDetector(
onHorizontalDragEnd: _handleHorizontalDrag, // 添加水平滑动检测
@@ -228,7 +229,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
children: [
Container(
width:
115.rpx, // 固定宽度为 160.rpx
150.rpx, // 固定宽度为 160.rpx
alignment:
Alignment.center, // 文字居中
child: Text(
@@ -267,7 +268,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 115
width: 150
.rpx, // 固定宽度为 160.rpx
alignment: Alignment
.center, // 文字居中
@@ -309,7 +310,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 115
width: 150
.rpx, // 固定宽度为 160.rpx
alignment: Alignment
.center, // 文字居中
@@ -352,8 +353,8 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
: sleepReportController
.model.type ==
2
? 115.rpx
: 230.rpx,
? 150.rpx
: 300.rpx,
child: Container(
width: lineWidth,
height: 4.rpx,
@@ -390,172 +391,79 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
widget.data['backgroundColor'] != null
? widget.data['backgroundColor']
: themeController.currentColor.sc5,
highlightColor: themeController
.currentColor.sc5, // 或你希望的点击水波纹颜色
borderRadius: AppConstants()
.normal_container_radius, // 如果你想加圆角可以设置 eg. 12.rpx
highlightColor: themeController.currentColor.sc5,
borderRadius:
AppConstants().normal_container_radius,
padding: EdgeInsets.zero,
onTap: () {},
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
flex: 2,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 0.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 左侧信息列 (姓名、年龄)
Expanded(
flex: 2,
child: Padding(
padding: EdgeInsets.fromLTRB(
16.rpx, 0, 0, 0),
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'姓名'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'年龄'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(
SizedBox(height: 34.rpx)),
_buildBaselineRow(
label: '姓名'.tr,
value: (widget.data['person']
?['name']
?.toString()
.trim()
.isNotEmpty ??
false)
? widget
.data['person']!['name']
.toString()
: '未知数据'.tr,
themeController: themeController,
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
(widget.data['person']
?['name']
?.toString()
.trim()
.isNotEmpty ??
false)
? widget.data['person']![
'name']
.toString()
: '未知数据'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
Text(
SizedBox(height: 34.rpx),
_buildBaselineRow(
label: '年龄'.tr,
value:
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(widget.data['person']?['birthday'])) ?? '未知数据'.tr}',
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(
SizedBox(height: 34.rpx)),
themeController: themeController,
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(
SizedBox(width: 37.rpx)),
],
),
]
.addToStart(SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
),
),
),
Flexible(
flex: 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
// 右侧信息列 (设备ID、体重)
Expanded(
flex: 3,
child: Padding(
padding: EdgeInsets.fromLTRB(
16.rpx, 36.rpx, 0, 36.rpx),
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'设备ID'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'体重'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(
SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
_buildBaselineRow(
label: '设备ID'.tr,
value:
'${widget.data['code'] ?? widget.data['mac']}',
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
maxLines: 1,
overflow:
TextOverflow.ellipsis,
),
Text(
'${widget.data['person']?['weight'] ?? '未知数据'.tr}kg',
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(
SizedBox(height: 34.rpx)),
themeController: themeController,
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(
SizedBox(width: 37.rpx)),
SizedBox(height: 34.rpx),
_buildBaselineRow(
label: '体重'.tr,
value:
'${widget.data['person']?['weight'] ?? '未知数据'.tr}kg',
themeController: themeController,
),
],
),
]
.addToStart(SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
),
),
),
],
],
),
),
),
),
@@ -652,8 +560,8 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
: sleepReportController
.model.type ==
2
? 115.rpx
: 230.rpx,
? 150.rpx
: 300.rpx,
child: Container(
width: lineWidth,
height: 4.rpx,
@@ -699,165 +607,222 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
// Flexible(
// flex: 2,
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.end,
// children: [
// Text(
// '姓名'.tr,
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// Text(
// '年龄'.tr,
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// ].divide(
// SizedBox(height: 34.rpx)),
// ),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// (widget.data['person']
// ?['name']
// ?.toString()
// .trim()
// .isNotEmpty ??
// false)
// ? widget
// .data['person']![
// 'name']
// .toString()
// : '未知数据'.tr,
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// ),
// Text(
// '${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(widget.data['person']?['birthday'])) ?? '未知数据'.tr}',
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// ),
// ].divide(
// SizedBox(height: 34.rpx)),
// ),
// ]
// .divide(SizedBox(width: 33.rpx))
// .addToStart(
// SizedBox(width: 37.rpx)),
// ),
// ]
// .addToStart(
// SizedBox(height: 36.rpx))
// .addToEnd(SizedBox(height: 36.rpx)),
// ),
// ),
// Flexible(
// flex: 3,
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.end,
// children: [
// Text(
// '设备ID'.tr,
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// Text(
// '体重'.tr,
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// ].divide(
// SizedBox(height: 34.rpx)),
// ),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// // '${widget.data['code'] ?? '未知数据'.tr}',
// '${widget.data['code'] ?? widget.data['mac']}',
// // "D11250300003",
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// maxLines: 1,
// overflow:
// TextOverflow.ellipsis,
// ),
// Text(
// '${widget.data['person']?['weight'] ?? '未知数据'.tr}kg',
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// ),
// ].divide(
// SizedBox(height: 34.rpx)),
// ),
// ]
// .divide(SizedBox(width: 33.rpx))
// .addToStart(
// SizedBox(width: 37.rpx)),
// ),
// ]
// .addToStart(
// SizedBox(height: 36.rpx))
// .addToEnd(SizedBox(height: 36.rpx)),
// ),
// ),
Expanded(
flex: 2,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'姓名'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'年龄'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(
SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
(widget.data['person']
?['name']
?.toString()
.trim()
.isNotEmpty ??
false)
? widget
.data['person']![
'name']
.toString()
: '未知数据'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
Text(
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(widget.data['person']?['birthday'])) ?? '未知数据'.tr}',
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(
SizedBox(height: 34.rpx)),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(
SizedBox(width: 37.rpx)),
),
]
.addToStart(
SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
child: Padding(
padding: EdgeInsets.fromLTRB(
16.rpx, 0, 0, 0),
child: Column(
children: [
_buildBaselineRow(
label: '姓名'.tr,
value: (widget.data['person']
?['name']
?.toString()
.trim()
.isNotEmpty ??
false)
? widget
.data['person']!['name']
.toString()
: '未知数据'.tr,
themeController: themeController,
),
SizedBox(height: 34.rpx),
_buildBaselineRow(
label: '年龄'.tr,
value:
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(widget.data['person']?['birthday'])) ?? '未知数据'.tr}',
themeController: themeController,
),
],
),
),
),
Flexible(
Expanded(
flex: 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'设备ID'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'体重'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(
SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
// '${widget.data['code'] ?? '未知数据'.tr}',
'${widget.data['code'] ?? widget.data['mac']}',
// "D11250300003",
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
maxLines: 1,
overflow:
TextOverflow.ellipsis,
),
Text(
'${widget.data['person']?['weight'] ?? '未知数据'.tr}kg',
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(
SizedBox(height: 34.rpx)),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(
SizedBox(width: 37.rpx)),
),
]
.addToStart(
SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
child: Padding(
padding: EdgeInsets.fromLTRB(
16.rpx, 36.rpx, 0, 36.rpx),
child: Column(
children: [
_buildBaselineRow(
label: '设备ID'.tr,
value:
'${widget.data['code'] ?? widget.data['mac']}',
themeController: themeController,
),
SizedBox(height: 34.rpx),
_buildBaselineRow(
label: '体重'.tr,
value:
'${widget.data['person']?['weight'] ?? '未知数据'.tr}kg',
themeController: themeController,
),
],
),
),
),
],
@@ -1382,7 +1347,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 115.rpx,
width: 150.rpx,
alignment: Alignment.center,
child: Text(
title.tr,
@@ -1478,4 +1443,42 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
loadSleepReport(newType);
}
}
Widget _buildBaselineRow({
required String label,
required String value,
required ThemeController themeController,
}) {
return Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
// 描述label
SizedBox(
width: 100.rpx,
child: Text(
label,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 26.rpx,
color: themeController.currentColor.sc4,
),
),
),
SizedBox(width: 16.rpx),
// 值value
Expanded(
child: Text(
value,
style: TextStyle(
fontSize: 26.rpx,
color: themeController.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
);
}
}