更新睡眠报告

This commit is contained in:
wyf
2025-05-27 23:09:31 +08:00
parent e0fef11b33
commit 98cd7f4e6a
54 changed files with 4450 additions and 1160 deletions

View File

@@ -16,6 +16,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
final List<SleepDataModuleWidget> sleepDataModuleWidgets;
final ThemeController themeController = Get.find();
final Map targetDevice;
late ScrollController _scrollController;
DynamicReportDetailWidget({
required this.sleepDateWidgets,
@@ -25,6 +26,18 @@ class DynamicReportDetailWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
_scrollController = ScrollController();
WidgetsBinding.instance.addPostFrameCallback((_) {
if (_scrollController.hasClients) {
// _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
// 如果你希望有动画,用下面这句替代 jumpTo
_scrollController.animateTo(
_scrollController.position.maxScrollExtent,
duration: Duration(milliseconds: 300),
curve: Curves.easeOut,
);
}
});
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 25.rpx, 0, 25.rpx),
child: Container(
@@ -40,7 +53,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
_buildHeader(context,targetDevice),
_buildHeader(context, targetDevice),
SizedBox(
height: 33.rpx,
),
@@ -67,7 +80,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
borderRadius: 0,
padding: EdgeInsets.zero,
onTap: () async {
await Get.toNamed("/bodyDevice",arguments: targetDevice);
await Get.toNamed("/bodyDevice", arguments: targetDevice);
},
child: Text(
'${targetDevice['person']?['name'] == null ? '未命名'.tr : targetDevice['person']['name']}',
@@ -132,6 +145,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
width: double.infinity,
decoration: BoxDecoration(),
child: SingleChildScrollView(
controller: _scrollController, // ⭐️ 关键点
scrollDirection: Axis.horizontal,
child: Row(
mainAxisSize: MainAxisSize.max,

View File

@@ -101,76 +101,51 @@ class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
),
],
),
// Container(
// width: MediaQuery.sizeOf(context).width * 0.07,
// height: MediaQuery.sizeOf(context).height * 0.014,
// constraints: BoxConstraints(
// minWidth: 43.rpx,
// minHeight: 36.rpx,
// ),
// child: FFButtonWidget(
// onPressed: () {
// print('Button pressed ...');
// },
// // text: '${widget.data['level']}',
// text: '${widget.data['level']}',
// options: FFButtonOptions(
// height: 40.rpx,
// padding: EdgeInsets.zero,
// // color: themeController.currentColor.sc14,
// color: stringToColor('${widget.data['color']}'),
// textStyle:
// FlutterFlowTheme.of(context).titleSmall.override(
// fontFamily: 'Inter Tight',
// color: themeController.currentColor.sc3,
// // color: stringToColor('${widget.data['color']}'),
// letterSpacing: 0.0,
// fontSize: 15.rpx,
// ),
// elevation: 0,
// borderRadius: BorderRadius.circular(8.rpx),
// ),
// ),
// ),
ClickableContainer(
backgroundColor: stringToColor('${widget.data['color']}'),
highlightColor: themeController.currentColor.sc3,
padding: EdgeInsets.symmetric(
horizontal: 0.rpx,
vertical: 0.rpx,
),
borderRadius: 8.rpx,
onTap: () {
print('Button pressed ...');
},
child: Container(
alignment: Alignment.center,
constraints: BoxConstraints(
minWidth: 43.rpx,
minHeight: 36.rpx,
if (widget.data['level'] != null)
ClickableContainer(
backgroundColor: (widget.data['color'] == null ||
widget.data['color'].toString().isEmpty)
? Colors.transparent
: stringToColor(widget.data['color']),
highlightColor: themeController.currentColor.sc3,
padding: EdgeInsets.symmetric(
horizontal: 0.rpx,
vertical: 0.rpx,
),
child: Text(
'${widget.data['level']}',
style: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
fontSize: 15.rpx,
),
borderRadius: 8.rpx,
onTap: () {
print('Button pressed ...');
},
child: Container(
alignment: Alignment.center,
constraints: BoxConstraints(
minWidth: 43.rpx,
minHeight: 36.rpx,
),
child: Text(
'${widget.data['level']}',
style: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
fontSize: 15.rpx,
),
),
),
),
),
].divide(SizedBox(width: 0.rpx)),
),
Text(
'${widget.data['range']}',
"正常值".tr +
'${(widget.data['range'] ?? '').toString().isEmpty ? '未知数据'.tr : widget.data['range']}',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: AppConstants().small_text_fontSize,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),