This commit is contained in:
wyf
2025-05-15 13:57:42 +08:00
parent fb5c3864a3
commit 75ddfca402
51 changed files with 2451 additions and 1233 deletions

View File

@@ -4,7 +4,9 @@ import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/base/SleepCalendarWidget.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/device_calibration_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
@@ -789,7 +791,7 @@ void showProgressDialog(
ValueNotifier<bool> failureNotifier,
) {
ThemeController themeController = Get.find();
DeviceCalibrationController deviceCalibrationController = Get.find();
showDialog(
context: context,
barrierDismissible: false, // 点击对话框外部不可关闭
@@ -826,23 +828,28 @@ void showProgressDialog(
if (Navigator.canPop(dialogContext)) {
Navigator.of(dialogContext).pop();
}
TopSlideNotification.show(
context,
text: "设备校准失败".tr,
textColor: Colors.red,
);
// TopSlideNotification.show(
// context,
// text: "设备校准失败".tr,
// textColor: Colors.red,
// );
});
} else if (progress >= 1.0) {
} else if (progress >= 100) {
// 延迟关闭弹窗和提示成功(可选)
Future.delayed(Duration(milliseconds: 300), () {
if (Navigator.canPop(dialogContext)) {
Navigator.of(dialogContext).pop();
}
TopSlideNotification.show(
context,
text: "设备校准完成".tr,
textColor: themeController.currentColor.sc3,
);
// TopSlideNotification.show(
// context,
// text: "设备校准完成".tr,
// );
// Obx(() {
// TopSlideNotification.show(context,
// text:
// deviceCalibrationController.tips.value);
// return Container();
// });
});
}
@@ -852,7 +859,7 @@ void showProgressDialog(
Text(
isFailure
? '失败'.tr
: '${(progress * 100).toStringAsFixed(0)}%',
: '${(progress).toStringAsFixed(0)}%',
style: TextStyle(
fontSize: 26.rpx,
color: isFailure
@@ -877,22 +884,23 @@ void showProgressDialog(
width: progress *
MediaQuery.of(context).size.width *
0.8,
height: 10.rpx,
height: 21.rpx,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: isFailure
? [themeController.currentColor.sc9]
: [
themeController
.currentColor.sc1,
.currentColor.sc2,
themeController
.currentColor.sc2,
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius:
BorderRadius.circular(5.rpx),
borderRadius: BorderRadius.circular(
AppConstants().button_container_radius,
),
),
),
],
@@ -912,3 +920,30 @@ void showProgressDialog(
},
);
}
void showSleepCalendarBottomSheet({
required BuildContext context,
int? timestamp,
required void Function(DateTime selectedDate) onDateSelected,
}) {
showModalBottomSheet(
context: context,
isScrollControlled: false,
backgroundColor: Colors.transparent,
builder: (context) {
return Container(
decoration: BoxDecoration(
color: const Color(0xFF242835),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.rpx),
topRight: Radius.circular(20.rpx),
),
),
child: SleepCalendarWidget(
timestamp: timestamp,
onDateSelected: onDateSelected, // 传递回调下去
),
);
},
);
}