1.更新睡眠报告无数据时居中显示
2.更新控制按钮变圆圈 3.修复首页设备列表名称太长导致控制图标挤出去
This commit is contained in:
@@ -155,15 +155,6 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: (widget.data['backgroundImg'] != null &&
|
||||
// widget.data['backgroundImg'].toString().isNotEmpty)
|
||||
// ? AssetImage(widget.data['backgroundImg'])
|
||||
// : AssetImage('assets/img/bgNoImg.png') as ImageProvider,
|
||||
// fit: BoxFit.fill,
|
||||
// ),
|
||||
// ),
|
||||
decoration: BoxDecoration(
|
||||
image: (widget.data['noBackImg'] != null &&
|
||||
widget.data['noBackImg'] == true)
|
||||
@@ -176,7 +167,6 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 背景透明
|
||||
// appBar: AppBar(
|
||||
@@ -252,13 +242,12 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: SingleChildScrollView(
|
||||
child: Obx(() {
|
||||
var sleepReport = sleepReportController.sleepReport;
|
||||
print(sleepReport);
|
||||
child: Obx(() {
|
||||
var sleepReport = sleepReportController.sleepReport;
|
||||
print(sleepReport);
|
||||
if (sleepReport.isEmpty || sleepReport.isEmpty) {
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
@@ -767,7 +756,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
),
|
||||
(sleepReport.value == null || sleepReport.value.isEmpty)
|
||||
? Container(
|
||||
child: NullDataWidget(),
|
||||
child: Expanded(child: NullDataWidget()),
|
||||
)
|
||||
: (sleepReportController.model.type == 1
|
||||
? DailyDataWidget(sleepReport, sleepCardKey,
|
||||
@@ -782,8 +771,561 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
height: 25.rpx,
|
||||
)),
|
||||
);
|
||||
}),
|
||||
),
|
||||
} else {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: widget.data['backgroundColor'] != null
|
||||
? widget.data['backgroundColor']
|
||||
: themeController.currentColor.sc5,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 15.rpx, 30.rpx, 15.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.bottomLeft,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController
|
||||
.currentColor.sc3,
|
||||
borderRadius: 8.rpx,
|
||||
padding: EdgeInsets.all(0),
|
||||
onTap: () async {
|
||||
sleepReportController.model.type =
|
||||
1;
|
||||
|
||||
String data = MyUtils.formatDate(
|
||||
calendarController
|
||||
.selectedDate.value!);
|
||||
await requestWithLog(
|
||||
logTitle: "查询睡眠报告",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl:
|
||||
"https://sleepdata.he-info.com/api/analysis/sleep/analysis?mac=${widget.data['mac']}&time=${data}&type=${sleepReportController.model.type}",
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
sleepReportController
|
||||
.sleepReport
|
||||
.value = res.data;
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
},
|
||||
onFailure: (res) {
|
||||
if (MainPageBBottomChange
|
||||
.getCurrentIndex() !=
|
||||
null) {
|
||||
if (MainPageBBottomChange
|
||||
.getCurrentIndex() ==
|
||||
1) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
}
|
||||
} else {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
}
|
||||
sleepReportController
|
||||
.sleepReport.value = {};
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
print(res);
|
||||
});
|
||||
sleepReportController.updateAll();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width:
|
||||
115.rpx, // 固定宽度为 160.rpx
|
||||
alignment:
|
||||
Alignment.center, // 文字居中
|
||||
child: Text(
|
||||
'日报'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color: sleepReportController
|
||||
.model.type ==
|
||||
1
|
||||
? themeController
|
||||
.currentColor.sc2
|
||||
: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
return ClickableContainer(
|
||||
backgroundColor:
|
||||
Colors.transparent,
|
||||
highlightColor: themeController
|
||||
.currentColor.sc3,
|
||||
borderRadius: 8.rpx,
|
||||
padding: EdgeInsets.all(0),
|
||||
onTap: () async {
|
||||
sleepReportController
|
||||
.model.type = 2;
|
||||
String data =
|
||||
MyUtils.formatDate(
|
||||
calendarController
|
||||
.selectedDate
|
||||
.value!);
|
||||
await requestWithLog(
|
||||
logTitle: "查询睡眠报告",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl:
|
||||
"https://sleepdata.he-info.com/api/analysis/sleep/analysis?mac=${widget.data['mac']}&time=${data}&type=${sleepReportController.model.type}",
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
sleepReportController
|
||||
.sleepReport
|
||||
.value = res.data;
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
},
|
||||
onFailure: (res) {
|
||||
if (MainPageBBottomChange
|
||||
.getCurrentIndex() !=
|
||||
null) {
|
||||
if (MainPageBBottomChange
|
||||
.getCurrentIndex() ==
|
||||
1) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
}
|
||||
} else {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
}
|
||||
sleepReportController
|
||||
.sleepReport
|
||||
.value = {};
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
print(res);
|
||||
});
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 115
|
||||
.rpx, // 固定宽度为 160.rpx
|
||||
alignment: Alignment
|
||||
.center, // 文字居中
|
||||
child: Text('周报'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color: sleepReportController
|
||||
.model
|
||||
.type ==
|
||||
2
|
||||
? themeController
|
||||
.currentColor
|
||||
.sc2
|
||||
: themeController
|
||||
.currentColor
|
||||
.sc3,
|
||||
)),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Obx(() {
|
||||
return ClickableContainer(
|
||||
backgroundColor:
|
||||
Colors.transparent,
|
||||
highlightColor: themeController
|
||||
.currentColor.sc3,
|
||||
borderRadius: 8.rpx,
|
||||
padding: EdgeInsets.all(0),
|
||||
onTap: () async {
|
||||
sleepReportController
|
||||
.model.type = 3;
|
||||
String data =
|
||||
MyUtils.formatDate(
|
||||
calendarController
|
||||
.selectedDate
|
||||
.value!);
|
||||
await requestWithLog(
|
||||
logTitle: "查询睡眠报告",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl:
|
||||
"https://sleepdata.he-info.com/api/analysis/sleep/analysis?mac=${widget.data['mac']}&time=${data}&type=${sleepReportController.model.type}",
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
sleepReportController
|
||||
.sleepReport
|
||||
.value = res.data;
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
},
|
||||
onFailure: (res) {
|
||||
if (MainPageBBottomChange
|
||||
.getCurrentIndex() !=
|
||||
null) {
|
||||
if (MainPageBBottomChange
|
||||
.getCurrentIndex() ==
|
||||
1) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
}
|
||||
} else {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
}
|
||||
sleepReportController
|
||||
.sleepReport
|
||||
.value = {};
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
print(res);
|
||||
});
|
||||
|
||||
sleepReportController
|
||||
.updateAll();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 115
|
||||
.rpx, // 固定宽度为 160.rpx
|
||||
alignment: Alignment
|
||||
.center, // 文字居中
|
||||
child: Text(
|
||||
'月报'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color:
|
||||
sleepReportController
|
||||
.model
|
||||
.type ==
|
||||
3
|
||||
? themeController
|
||||
.currentColor
|
||||
.sc2
|
||||
: themeController
|
||||
.currentColor
|
||||
.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
AnimatedPositioned(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: 0,
|
||||
left:
|
||||
sleepReportController.model.type ==
|
||||
1
|
||||
? 0
|
||||
: sleepReportController
|
||||
.model.type ==
|
||||
2
|
||||
? 115.rpx
|
||||
: 230.rpx,
|
||||
child: Container(
|
||||
width: lineWidth,
|
||||
height: 4.rpx,
|
||||
decoration: BoxDecoration(
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
borderRadius:
|
||||
BorderRadius.circular(2.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 32.rpx, 30.rpx, 32.rpx),
|
||||
child: getTimeWidget(),
|
||||
),
|
||||
),
|
||||
if (widget.data['person_show'] == null ||
|
||||
widget.data['person_show'] != false)
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 51.rpx),
|
||||
child: ClickableContainer(
|
||||
backgroundColor:
|
||||
widget.data['backgroundColor'] != null
|
||||
? widget.data['backgroundColor']
|
||||
: themeController.currentColor.sc5,
|
||||
highlightColor: themeController
|
||||
.currentColor.sc5, // 或你希望的点击水波纹颜色
|
||||
borderRadius: AppConstants()
|
||||
.normal_container_radius, // 如果你想加圆角可以设置 eg. 12.rpx
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
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}',
|
||||
// "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)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
(sleepReport.value == null || sleepReport.value.isEmpty)
|
||||
? Container(
|
||||
child: NullDataWidget(),
|
||||
)
|
||||
: (sleepReportController.model.type == 1
|
||||
? DailyDataWidget(
|
||||
sleepReport,
|
||||
sleepCardKey,
|
||||
heartRateCardKey,
|
||||
breatheCardKey,
|
||||
widget.data)
|
||||
: sleepReportController.model.type == 2
|
||||
? WeekDataWidget(sleepReport, widget.data)
|
||||
: sleepReportController.model.type == 3
|
||||
? MonthDataWidget(
|
||||
sleepReport, widget.data)
|
||||
: NullDataWidget()),
|
||||
].divide(SizedBox(
|
||||
height: 25.rpx,
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user