This commit is contained in:
wyf
2025-05-13 11:59:04 +08:00
parent eae7a2284d
commit fb5c3864a3
101 changed files with 8427 additions and 1953 deletions

View File

@@ -44,7 +44,7 @@ class _HomePageState extends State<HomePage> {
final position = renderBox.localToGlobal(Offset.zero);
final size = renderBox.size;
double popupWidth = 190.rpx; // 弹窗宽度(可以改)
double popupWidth = 190.rpx;
_popupEntry?.remove(); // 清除旧弹窗
_popupEntry = OverlayEntry(
@@ -106,7 +106,7 @@ class _HomePageState extends State<HomePage> {
width: double.infinity,
child: Center(
child: Text(
'扫一扫'.tr,
'扫一扫.标题'.tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
@@ -131,7 +131,7 @@ class _HomePageState extends State<HomePage> {
width: double.infinity,
child: Center(
child: Text(
'蓝牙绑定'.tr,
'蓝牙绑定.标题'.tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
@@ -254,7 +254,7 @@ class _HomePageState extends State<HomePage> {
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
// width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional
@@ -314,13 +314,6 @@ class _HomePageState extends State<HomePage> {
),
);
}),
// SvgPicture.asset(
// 'assets/img/icon/add.svg',
// width: 39.rpx,
// height: 39.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
// //todo 颜色
// color: themeController.currentColor.sc16,
// ),
ClickableContainer(
key: addIconKey,
backgroundColor: Colors.transparent,
@@ -553,10 +546,41 @@ class _HomePageState extends State<HomePage> {
CustomCard(
borderRadius: AppConstants()
.button_container_radius, // 圆角半径
onTap: () {
onTap: () async {
if (userInfoController.model.login ==
LoginStatus.LOGIN.code) {
Get.toNamed("/deviceType");
await Get.toNamed("/deviceType");
homeController.getSleepReport();
deviceController
.getDeviceNum()
.then((apiResponse) {
if (apiResponse.code !=
HttpStatusCodes.ok) {
TopSlideNotification.show(
Get.context!,
text: apiResponse.msg!,
textColor: themeController
.currentColor.sc9,
);
}
});
deviceController
.getDeviceList()
.then((apiResponse) {
if (apiResponse.code !=
HttpStatusCodes.ok) {
TopSlideNotification.show(
Get.context!,
text: apiResponse.msg!,
textColor: themeController
.currentColor.sc9,
);
} else {
//请求睡眠报告
deviceController
.getSleepReport();
}
});
} else {
TopSlideNotification.show(
context,
@@ -681,7 +705,7 @@ class _HomePageState extends State<HomePage> {
.normal_text_fontSize,
letterSpacing: 0.0,
fontWeight:
FontWeight.w900,
FontWeight.w600,
color: stringToColor(
"#916D46"), //固定
),
@@ -763,19 +787,22 @@ class _HomePageState extends State<HomePage> {
backgroundColor:
themeController.currentColor.sc5,
highlightColor:
themeController.currentColor.sc3,
themeController.currentColor.sc21,
borderRadius: AppConstants()
.normal_container_radius,
padding: EdgeInsets
.zero, // 原始Container没有padding
onTap: () {
onTap: () async {
// BodyDeviceController
// bodyDeviceController = Get.find();
// bodyDeviceController.model.type = 1;
// Get.toNamed("/bodyDevice");
homeController.model.type = 1;
deviceController.model.type = 1;
deviceController.getDeviceList();
await deviceController
.getDeviceList();
await deviceController
.getSleepReport();
homeController.updateAll();
},
child: Container(
@@ -823,19 +850,17 @@ class _HomePageState extends State<HomePage> {
backgroundColor:
themeController.currentColor.sc5,
highlightColor:
themeController.currentColor.sc3,
themeController.currentColor.sc21,
borderRadius: AppConstants()
.normal_container_radius,
padding: EdgeInsets
.zero, // 原本的Container没有 padding这里设置为 zero
onTap: () {
// BodyDeviceController
// bodyDeviceController = Get.find();
// bodyDeviceController.model.type = 2;
// Get.toNamed("/bodyDevice");
padding: EdgeInsets.zero,
onTap: () async {
homeController.model.type = 2;
deviceController.model.type = 2;
deviceController.getDeviceList();
await deviceController
.getDeviceList();
await deviceController
.getSleepReport();
homeController.updateAll();
},
child: Container(
@@ -903,7 +928,6 @@ class _HomePageState extends State<HomePage> {
if (reportData.isEmpty) {
return Expanded(child: NullDataWidget());
}
List<String> macList = reportData.keys.toList();
macList = macList
.where(
@@ -911,8 +935,6 @@ class _HomePageState extends State<HomePage> {
.any((device) => device['mac'] == mac),
)
.toList();
// ⛔️防止 macList 长度和 deviceList.length 不对应导致崩溃
if (macList.length != deviceList.length) {
return Expanded(
child: Center(child: CircularProgressIndicator()),