更新睡眠的心率基准图不显示

This commit is contained in:
wyf
2025-07-17 10:06:13 +08:00
parent 80d6670ad9
commit f8cecba68b
95 changed files with 8859 additions and 9047 deletions

View File

@@ -52,315 +52,292 @@ class _MhtSleepReportPageState extends State<MhtSleepReportPage> {
});
int login = userInfoController.model.login!;
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
// // onTap: () => FocusScope.of(context).unfocus(),,
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
body: SafeArea(
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: (userInfoController.model.login! != null &&
userInfoController.model.login! == 1)
? MainAxisAlignment.start
: MainAxisAlignment.center,
children: [
//未登录
Obx(() {
if (userInfoController.model.login! == null ||
userInfoController.model.login! == 0) {
return Center(
child: InkWell(
onTap: () => Get.toNamed("/loginPage"),
child: RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Stack(
children: [
Text(
"登录",
style: TextStyle(
color: stringToColor("#84F5FF"),
fontSize: 30.rpx,
),
),
Positioned(
bottom: 0, // 控制下划线与文字的间距
left: 0,
right: 0,
child: Container(
height: 1, // 下划线粗细
color: stringToColor("#84F5FF"),
),
),
],
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
body: SafeArea(
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: (userInfoController.model.login! != null &&
userInfoController.model.login! == 1)
? MainAxisAlignment.start
: MainAxisAlignment.center,
children: [
//未登录
Obx(() {
if (userInfoController.model.login! == null ||
userInfoController.model.login! == 0) {
return Center(
child: InkWell(
onTap: () => Get.toNamed("/loginPage"),
child: RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Stack(
children: [
Text(
"登录",
style: TextStyle(
color: stringToColor("#84F5FF"),
fontSize: 30.rpx,
),
),
),
TextSpan(
text: "查看睡眠报告",
Positioned(
bottom: 0, // 控制下划线与文字的间距
left: 0,
right: 0,
child: Container(
height: 1, // 下划线粗细
color: stringToColor("#84F5FF"),
),
),
],
),
),
TextSpan(
text: "查看睡眠报告",
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
],
),
),
),
);
}
return Container();
}),
//已登录
Obx(() {
if (userInfoController.model.login! != null &&
userInfoController.model.login! == 1) {
final list = deviceController.personnelList.value;
// if (list.isNotEmpty &&
// formFieldController.value == null) {
// WidgetsBinding.instance.addPostFrameCallback((_) {
// formFieldController.value = list[0]["mac"];
// personInfo.value = list[0];
// homeController.selectPerson.value = list[0];
// homeController.selectDevcie.value = list[0]["mac"];
// deviceController
// .getSleeps(formFieldController.value);
// homeController.updateAll();
// });
// }
if (list.isNotEmpty) {
WidgetsBinding.instance.addPostFrameCallback((_) {
formFieldController.value = list[0]["mac"];
personInfo.value = list[0];
homeController.selectPerson.value = list[0];
homeController.selectDevcie.value = list[0]["mac"];
deviceController.getSleeps(formFieldController.value);
homeController.updateAll();
});
}
//themeController.currentColor.sc5,
if (homeController.personnelList.value.length != 0)
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 40.rpx, 30.rpx, 10.rpx),
child: Container(
width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints(
minHeight: 60.rpx,
),
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(20.rpx),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 16.rpx, 16.rpx, 25.rpx),
child: Container(
width: MediaQuery.sizeOf(context).width,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'健康报告'.tr,
style: TextStyle(
color: Colors.white,
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
ScrollbarTheme(
data: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(
Colors.transparent),
trackColor: MaterialStateProperty.all(
Colors.transparent),
trackBorderColor:
MaterialStateProperty.all(
Colors.transparent),
),
child: ValueListenableBuilder(
valueListenable: formFieldController,
builder: (c, a, s) => ClipRRect(
borderRadius:
BorderRadius.circular(36.rpx),
child: Theme(
data: Theme.of(context).copyWith(
splashColor: Colors.transparent,
highlightColor:
Colors.transparent,
hoverColor: Colors.transparent,
),
child:
FlutterFlowDropDown<String>(
controller: formFieldController,
options: deviceController
.personnelList.value
.map<String>(
(d) => "${d["mac"]}")
.toList(),
optionLabels: deviceController
.personnelList.value
.map<String>((d) {
var s = d["name"] ?? d["mac"];
if (s == null) {
return "";
} else {
return "$s";
}
}).toList(),
onChanged: (val) {
final list = deviceController
.personnelList.value;
final selectedPerson =
list.firstWhere(
(element) =>
element['mac'] == val,
orElse: () =>
null, // 防止找不到时报错
);
homeController.selectPerson
.value = selectedPerson;
personInfo.value =
selectedPerson;
homeController
.selectedDayIndex =
(6).obs;
print("$val");
if (val == null) {
homeController
.sleepDays.value = [];
} else {
homeController.selectDevcie
.value =
formFieldController
.value!;
deviceController.getSleeps(
formFieldController
.value);
homeController.updateAll();
}
},
width: 300.rpx,
height: 81.rpx,
maxHeight: 300.rpx,
textStyle: TextStyle(
fontSize: 28.rpx,
overflow:
TextOverflow.ellipsis,
color: Colors.white,
),
hintText: '',
icon: Icon(
Icons
.keyboard_arrow_down_rounded,
color:
stringToColor("#FFFFFF"),
size: 30.rpx,
),
fillColor:
stringToColor("#184468"),
elevation: 2,
borderColor: Colors.transparent,
borderWidth: 2,
borderRadius: 100.rpx,
margin: EdgeInsetsDirectional
.fromSTEB(32.rpx, 8.rpx,
32.rpx, 8.rpx),
hidesUnderline: true,
isOverButton: false,
isSearchable: false,
isMultiSelect: false,
),
))),
),
],
),
),
),
);
}
return Container();
}),
//已登录
Obx(() {
if (userInfoController.model.login! != null &&
userInfoController.model.login! == 1) {
final list = deviceController.personnelList.value;
// if (list.isNotEmpty &&
// formFieldController.value == null) {
// WidgetsBinding.instance.addPostFrameCallback((_) {
// formFieldController.value = list[0]["mac"];
// personInfo.value = list[0];
// homeController.selectPerson.value = list[0];
// homeController.selectDevcie.value = list[0]["mac"];
// deviceController
// .getSleeps(formFieldController.value);
// homeController.updateAll();
// });
// }
if (list.isNotEmpty) {
WidgetsBinding.instance.addPostFrameCallback((_) {
formFieldController.value = list[0]["mac"];
personInfo.value = list[0];
homeController.selectPerson.value = list[0];
homeController.selectDevcie.value = list[0]["mac"];
deviceController
.getSleeps(formFieldController.value);
homeController.updateAll();
});
}
//themeController.currentColor.sc5,
if (homeController.personnelList.value.length != 0)
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 40.rpx, 30.rpx, 10.rpx),
child: Container(
width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints(
minHeight: 60.rpx,
),
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(20.rpx),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 16.rpx, 16.rpx, 25.rpx),
child: Container(
width: MediaQuery.sizeOf(context).width,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'健康报告'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
ScrollbarTheme(
data: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(
Colors.transparent),
trackColor: MaterialStateProperty.all(
Colors.transparent),
trackBorderColor:
MaterialStateProperty.all(
Colors.transparent),
),
child: ValueListenableBuilder(
valueListenable:
formFieldController,
builder: (c, a, s) => ClipRRect(
borderRadius:
BorderRadius.circular(
36.rpx),
child: Theme(
data: Theme.of(context)
.copyWith(
splashColor:
Colors.transparent,
highlightColor:
Colors.transparent,
hoverColor:
Colors.transparent,
),
child: FlutterFlowDropDown<
String>(
controller:
formFieldController,
options: deviceController
.personnelList.value
.map<String>((d) =>
"${d["mac"]}")
.toList(),
optionLabels:
deviceController
.personnelList.value
.map<String>((d) {
var s =
d["name"] ?? d["mac"];
if (s == null) {
return "";
} else {
return "$s";
}
}).toList(),
onChanged: (val) {
final list =
deviceController
.personnelList
.value;
final selectedPerson =
list.firstWhere(
(element) =>
element['mac'] ==
val,
orElse: () =>
null, // 防止找不到时报错
);
homeController
.selectPerson
.value =
selectedPerson;
personInfo.value =
selectedPerson;
),
);
}
if (userInfoController.model.login != null &&
userInfoController.model.login == 1)
return Expanded(child: NullDataWidget());
return Container();
}),
homeController
.selectedDayIndex =
(6).obs;
print("$val");
if (val == null) {
homeController.sleepDays
.value = [];
} else {
homeController
.selectDevcie
.value =
formFieldController
.value!;
deviceController.getSleeps(
formFieldController
.value);
homeController
.updateAll();
}
},
width: 300.rpx,
height: 81.rpx,
maxHeight: 300.rpx,
textStyle: TextStyle(
fontSize: 28.rpx,
overflow:
TextOverflow.ellipsis,
color: Colors.white,
),
hintText: '',
icon: Icon(
Icons
.keyboard_arrow_down_rounded,
color: stringToColor(
"#FFFFFF"),
size: 30.rpx,
),
fillColor: stringToColor(
"#184468"),
elevation: 2,
borderColor:
Colors.transparent,
borderWidth: 2,
borderRadius: 100.rpx,
margin:
EdgeInsetsDirectional
.fromSTEB(
32.rpx,
8.rpx,
32.rpx,
8.rpx),
hidesUnderline: true,
isOverButton: false,
isSearchable: false,
isMultiSelect: false,
),
))),
),
],
),
),
),
),
);
}
if (userInfoController.model.login != null &&
userInfoController.model.login == 1)
return Expanded(child: NullDataWidget());
return Container();
}),
Obx(() {
if (homeController.selectDevcie.value != null &&
homeController.selectDevcie.value!.isNotEmpty &&
deviceController.personnelList.value.isNotEmpty)
return Expanded(
child: NewSleepReportPage(
data: {
"tag": "123",
'date': DateTime.now().millisecondsSinceEpoch,
'mac': homeController.selectDevcie.value,
'person': homeController.selectPerson.value,
'backgroundImg': 'assets/images/new_background.png',
'arrow': false,
'noBackImg': true,
'person_show': false,
},
),
);
// }
return Container();
}),
Obx(() {
if (homeController.selectDevcie.value != null &&
homeController.selectDevcie.value!.isNotEmpty &&
deviceController.personnelList.value.isNotEmpty)
return Expanded(
child: NewSleepReportPage(
data: {
"tag": "123",
'date': DateTime.now().millisecondsSinceEpoch,
'mac': homeController.selectDevcie.value,
'person': homeController.selectPerson.value,
'backgroundImg':
'assets/images/new_background.png',
'arrow': false,
'noBackImg': true,
'person_show': false,
},
),
);
// }
return Container();
}),
// Expanded(
// child: NewSleepReportPage(
// data: {
// "tag": "123",
// 'date': DateTime.now().millisecondsSinceEpoch,
// 'mac': homeController.selectDevcie.value,
// 'person': homeController.selectPerson.value,
// 'backgroundImg': 'assets/images/new_background.png',
// },
// ),
// ),
// }
],
),
),
// Expanded(
// child: NewSleepReportPage(
// data: {
// "tag": "123",
// 'date': DateTime.now().millisecondsSinceEpoch,
// 'mac': homeController.selectDevcie.value,
// 'person': homeController.selectPerson.value,
// 'backgroundImg': 'assets/images/new_background.png',
// },
// ),
// ),
// }
],
),
),
));
),
),
));
}
}

View File

@@ -37,7 +37,7 @@ class _MhtSleepReportReturnPageState extends State<MhtSleepReportReturnPage> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
// onTap: () => FocusScope.of(context).unfocus(),,
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(

File diff suppressed because it is too large Load Diff