更新ios蓝牙权限
This commit is contained in:
@@ -548,7 +548,7 @@ class MyApp extends StatelessWidget {
|
||||
return GetMaterialApp(
|
||||
translations: AppLanguage(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: '',
|
||||
title: '智慧眠花糖',
|
||||
theme: themeController.currentTheme,
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
@@ -636,7 +636,7 @@ class MyApp extends StatelessWidget {
|
||||
const Locale('en', 'US'), // ⚠️ 添加你支持的语言
|
||||
],
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: '',
|
||||
title: '太和e护',
|
||||
theme: themeController.currentTheme,
|
||||
// home: const MyHomePage(title: '智慧眠花糖 Home Page'),
|
||||
initialRoute: "/mianPageBottomChange",
|
||||
|
||||
@@ -81,35 +81,36 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 11.rpx),
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc16.withOpacity(0.1),
|
||||
borderRadius: 0.rpx,
|
||||
onTap: () {
|
||||
print('点击扫一扫');
|
||||
_hidePopup();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "待开发.提示".tr,
|
||||
textColor: themeController.currentColor.sc2,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'扫一扫.标题'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 35.rpx),
|
||||
// ClickableContainer(
|
||||
// padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor:
|
||||
// themeController.currentColor.sc16.withOpacity(0.1),
|
||||
// borderRadius: 0.rpx,
|
||||
// onTap: () {
|
||||
// print('点击扫一扫');
|
||||
// _hidePopup();
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "待开发.提示".tr,
|
||||
// textColor: themeController.currentColor.sc2,
|
||||
// );
|
||||
// },
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// '扫一扫.标题'.tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: AppConstants().normal_text_fontSize,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 35.rpx),
|
||||
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/mh_language_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
||||
import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/MattressControl.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/mht_sleep_report_page.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/new_Home_page.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/new_mine_page.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart';
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
|
||||
class MainPageBBottomChange extends StatefulWidget {
|
||||
// 全局 key,用于静态访问 _HomePageState
|
||||
|
||||
@@ -94,34 +94,35 @@ class _HomePageState extends State<HomePage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 11.rpx),
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc16.withOpacity(0.1),
|
||||
borderRadius: 0.rpx,
|
||||
onTap: () {
|
||||
_popupEntry?.remove();
|
||||
_popupEntry = null;
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "待开发功能".tr,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'扫一扫.标题'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 35.rpx),
|
||||
// ClickableContainer(
|
||||
// padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor:
|
||||
// themeController.currentColor.sc16.withOpacity(0.1),
|
||||
// borderRadius: 0.rpx,
|
||||
// onTap: () {
|
||||
// _popupEntry?.remove();
|
||||
// _popupEntry = null;
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "待开发功能".tr,
|
||||
// );
|
||||
// },
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// '扫一扫.标题'.tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: AppConstants().normal_text_fontSize,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 35.rpx),
|
||||
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
@@ -201,6 +204,26 @@ Future<Map> checkBlueToothPermissin() async {
|
||||
var bluetoothConnectGranted;
|
||||
var locationGranted;
|
||||
|
||||
if (Platform.isIOS) {
|
||||
PermissionStatus isBleGranted = await Permission.bluetooth.request();
|
||||
if (isBleGranted.isGranted) {
|
||||
// startBluetoothScanning();
|
||||
await FlutterBluePlus.startScan(timeout: Duration(seconds: 10));
|
||||
data = {
|
||||
'bluetoothScanGranted': true,
|
||||
'bluetoothConnectGranted': true,
|
||||
};
|
||||
} else {
|
||||
try {
|
||||
await FlutterBluePlus.startScan(timeout: Duration(seconds: 10));
|
||||
} catch (e) {
|
||||
TopSlideNotification.show(Get.context!,
|
||||
text: "蓝牙权限未开启,请在设置中开启蓝牙权限".tr,
|
||||
textColor: themeController.currentColor.sc9);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
} else {
|
||||
try {
|
||||
// 先显示权限说明弹窗(同屏显示)
|
||||
bool bluetoothScanPermanentlyDenied =
|
||||
@@ -237,7 +260,9 @@ Future<Map> checkBlueToothPermissin() async {
|
||||
bluetoothConnectGranted = await Permission.bluetoothConnect.isGranted;
|
||||
locationGranted = await Permission.location.isGranted;
|
||||
|
||||
if (!bluetoothScanGranted || !bluetoothConnectGranted || !locationGranted) {
|
||||
if (!bluetoothScanGranted ||
|
||||
!bluetoothConnectGranted ||
|
||||
!locationGranted) {
|
||||
await [
|
||||
Permission.bluetoothScan,
|
||||
Permission.bluetoothConnect,
|
||||
@@ -266,6 +291,7 @@ Future<Map> checkBlueToothPermissin() async {
|
||||
Navigator.of(Get.context!, rootNavigator: true).pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
userInfoController.initLocationpermission = 1;
|
||||
return data;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
import 'package:easydevice/easydevice.dart';
|
||||
@@ -236,11 +237,21 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
if (data == null || data.isEmpty) {
|
||||
return false;
|
||||
}
|
||||
if (Platform.isIOS) {
|
||||
if (!data['bluetoothScanGranted'] ||
|
||||
!data['bluetoothConnectGranted']) {
|
||||
return false;
|
||||
}
|
||||
} else if (Platform.isAndroid) {
|
||||
if (!data['bluetoothScanGranted'] ||
|
||||
!data['bluetoothConnectGranted'] ||
|
||||
!data['locationGranted']) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
ef.log("[网页加载失败]:$e");
|
||||
@@ -565,12 +576,14 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
// return (controller.ready.value && (MainPageBBottomChange.getCurrentIndex() == 2))
|
||||
return (controller.ready.value)
|
||||
? controller.web.build()
|
||||
: Center(child:CircularProgressIndicator(
|
||||
: Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
themeController.currentColor.sc1,
|
||||
),
|
||||
),);
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user