fix:增加配网时读取手机系统wifi,并判断是否是5G网络
This commit is contained in:
parent
92093b3182
commit
4ff00eb90c
@ -51,6 +51,17 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage>
|
||||
logic.senderConfiguringWifiAction();
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
'请确保网络是2.4GHz Wi-Fi ',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:network_info_plus/network_info_plus.dart';
|
||||
|
||||
import '../../lockSet/lockSetInfo_entity.dart';
|
||||
import 'configuringWifiEntity.dart';
|
||||
|
||||
class ConfiguringWifiState{
|
||||
class ConfiguringWifiState {
|
||||
ConfiguringWifiState() {
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map['lockSetInfoData'];
|
||||
@ -18,6 +18,7 @@ class ConfiguringWifiState{
|
||||
wifiNameController.text = wifiName.value;
|
||||
}
|
||||
}
|
||||
|
||||
Rx<ConfiguringWifiEntity> configuringWifiEntity = ConfiguringWifiEntity().obs;
|
||||
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
||||
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
|
||||
@ -25,12 +26,12 @@ class ConfiguringWifiState{
|
||||
RxString wifiName = ''.obs;
|
||||
RxString pageName = ''.obs;
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
RxInt sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
RxInt sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||
|
||||
TextEditingController wifiNameController = TextEditingController();
|
||||
TextEditingController wifiPWDController = TextEditingController();
|
||||
String getGatewayConfigurationStr = '';
|
||||
|
||||
RxBool isLoading=false.obs;
|
||||
RxBool isLoading = false.obs;
|
||||
Timer? loadingTimer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:network_info_plus/network_info_plus.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
@ -91,11 +92,23 @@ class _WifiListPageState extends State<WifiListPage> {
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.configuringWifiPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'pageName': state.pageName.value,
|
||||
});
|
||||
onClick: () async {
|
||||
// 如果没有传wifi昵称,则使用当前系统连接的wifi
|
||||
final info = NetworkInfo();
|
||||
|
||||
final wifiName =
|
||||
(await info.getWifiName())?.replaceAll('"', '') ?? '';
|
||||
|
||||
// 判断是否为5G WiFi
|
||||
if (wifiName.toLowerCase().contains('5g')) {
|
||||
logic.showToast('请将手机切换至2.4G WiFi进行手动连接'.tr);
|
||||
} else {
|
||||
Get.toNamed(Routers.configuringWifiPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'pageName': state.pageName.value,
|
||||
'wifiName': wifiName,
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user