1.更新眠花糖ios控制页空白 2.修复ios首页第一次点击控制无效果 3.修复ios扫描蓝牙的错误提示

This commit is contained in:
2026-04-03 15:07:25 +08:00
parent bdeef22130
commit ca00faad0b
4 changed files with 195 additions and 206 deletions

View File

@@ -54,7 +54,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
),
settings: buildsettings(),
params: PlatformHeadlessInAppWebViewCreationParams(
onLoadStop: (controller, url) {
onLoadStop: (controller, url) async {
setState(() {
ready.value = true;
});
@@ -64,6 +64,9 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
// ef.log("[请求资源时间]${web.requestTimestamp}");
// _startMonitoringIfNeeded();
},
initialSettings: InAppWebViewSettings(
allowsBackForwardNavigationGestures: false, // 禁用侧滑返回/前进手势
),
),
);
try {
@@ -617,186 +620,160 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
final mainAxisAlignment =
showWeb ? MainAxisAlignment.start : MainAxisAlignment.center;
return Scaffold(
backgroundColor: Colors.transparent,
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment,
children: [
// 未登录提示
if (!isLoggedIn)
Center(
child: InkWell(
onTap: () => Get.toNamed("/loginPage"),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: "请先".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
WidgetSpan(
child: Stack(
children: [
Text(
"登录".tr,
style: TextStyle(
color: stringToColor("#84F5FF"),
fontSize: 30.rpx,
),
return PopScope(
canPop: false, // 完全禁止页面返回
onPopInvoked: (didPop) async {
if (didPop) return;
},
child: Scaffold(
backgroundColor: Colors.transparent,
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment,
children: [
// 未登录提示
if (!isLoggedIn)
Center(
child: InkWell(
onTap: () => Get.toNamed("/loginPage"),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: "请先".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 1,
color: stringToColor("#84F5FF"),
),
),
],
),
),
TextSpan(
text: "后,再进行设备控制".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
],
),
),
),
),
// 已登录但无设备提示
if (isLoggedIn && !hasDevice)
Center(
child: InkWell(
onTap: () => Get.toNamed("/mHTDeviceTypePage"),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: "请先".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
WidgetSpan(
child: Stack(
children: [
Text(
"绑定设备".tr,
style: TextStyle(
color: stringToColor("#84F5FF"),
fontSize: 30.rpx,
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 1,
color: stringToColor("#84F5FF"),
),
),
],
),
),
TextSpan(
text: "后,再进行设备控制".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
],
),
),
),
),
// 显示 WebView
if (showWeb)
Expanded(
child: Align(
alignment: Alignment.topLeft,
child: Obx(() {
// return (controller.ready.value && (MainPageBBottomChange.getCurrentIndex() == 2))
// return (controller.ready.value && (MainPageBBottomChange.getCurrentIndex() == 2)&& controller.loadRecource.value == true)
// return Stack(children: [
// controller.ready.value
// ? controller.web.build()
// : Container(),
// Text("1222121212"),
// ]);
// return Stack(
// children: [
// controller.ready.value
// ? controller.web.build()
// : Container(),
// // 只有 loadRecource == false 时才显示覆盖文字
// if (!controller.loadRecource.value)
// Positioned.fill(
// child: Container(
// color: Colors.black54, // 半透明遮罩,可选
// alignment: Alignment.center,
// child: Text(
// "资源加载中...",
// style: TextStyle(
// color: Colors.red,
// fontSize: 30.rpx,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ),
// ],
// );
return Stack(
children: [
controller.ready.value
? controller.web.build()
: Container(),
if (!controller.loadRecource.value)
Positioned.fill(
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/images/new_background.png'),
fit: BoxFit.fill,
),
),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
),
WidgetSpan(
child: Stack(
children: [
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
Colors.white),
Text(
"登录".tr,
style: TextStyle(
color: stringToColor("#84F5FF"),
fontSize: 30.rpx,
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 1,
color: stringToColor("#84F5FF"),
),
),
],
),
),
),
],
);
}),
),
),
],
),
);
TextSpan(
text: "后,再进行设备控制".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
],
),
),
),
),
// 已登录但无设备提示
if (isLoggedIn && !hasDevice)
Center(
child: InkWell(
onTap: () => Get.toNamed("/mHTDeviceTypePage"),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: "请先".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
WidgetSpan(
child: Stack(
children: [
Text(
"绑定设备".tr,
style: TextStyle(
color: stringToColor("#84F5FF"),
fontSize: 30.rpx,
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 1,
color: stringToColor("#84F5FF"),
),
),
],
),
),
TextSpan(
text: "后,再进行设备控制".tr,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
],
),
),
),
),
// 显示 WebView
if (showWeb)
Expanded(
child: Align(
alignment: Alignment.topLeft,
child: Obx(() {
return Stack(
children: [
controller.ready.value
? controller.web.build()
: Container(),
if (!controller.loadRecource.value)
Positioned.fill(
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/images/new_background.png'),
fit: BoxFit.fill,
),
),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<Color>(
Colors.white),
),
],
),
),
),
],
);
}),
),
),
],
),
));
});
}
}