2023-07-18 18:10:57 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
2024-09-19 09:26:07 +08:00
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
2023-07-18 18:10:57 +08:00
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
2024-09-19 09:26:07 +08:00
|
|
|
|
import '../../../../appRouters.dart';
|
2023-07-18 18:10:57 +08:00
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
2024-09-19 09:26:07 +08:00
|
|
|
|
import '../../../../tools/appRouteObserver.dart';
|
2023-07-18 18:10:57 +08:00
|
|
|
|
import '../../../../tools/commonItem.dart';
|
|
|
|
|
|
import '../../../../tools/submitBtn.dart';
|
|
|
|
|
|
import '../../../../tools/titleAppBar.dart';
|
2024-08-19 11:01:37 +08:00
|
|
|
|
import 'gatewayConfigurationWifi_logic.dart';
|
|
|
|
|
|
import 'gatewayConfigurationWifi_state.dart';
|
2023-07-18 18:10:57 +08:00
|
|
|
|
|
|
|
|
|
|
class GatewayConfigurationWifiPage extends StatefulWidget {
|
|
|
|
|
|
const GatewayConfigurationWifiPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
2023-07-27 15:26:30 +08:00
|
|
|
|
State<GatewayConfigurationWifiPage> createState() =>
|
|
|
|
|
|
_GatewayConfigurationWifiPageState();
|
2023-07-18 18:10:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-13 10:59:42 +08:00
|
|
|
|
class _GatewayConfigurationWifiPageState
|
|
|
|
|
|
extends State<GatewayConfigurationWifiPage> with RouteAware {
|
|
|
|
|
|
final GatewayConfigurationWifiLogic logic =
|
|
|
|
|
|
Get.put(GatewayConfigurationWifiLogic());
|
|
|
|
|
|
final GatewayConfigurationWifiState state =
|
|
|
|
|
|
Get.find<GatewayConfigurationWifiLogic>().state;
|
2023-07-18 18:10:57 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
appBar: TitleAppBar(
|
2024-08-19 11:01:37 +08:00
|
|
|
|
barTitle: '配置网络'.tr,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
haveBack: true,
|
|
|
|
|
|
backgroundColor: AppColors.mainColor),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
body: Column(
|
2024-07-31 20:02:38 +08:00
|
|
|
|
children: <Widget>[
|
2024-08-19 11:01:37 +08:00
|
|
|
|
// Container(
|
|
|
|
|
|
// width: 1.sw,
|
|
|
|
|
|
// color: const Color(0xFFF2F6F9),
|
|
|
|
|
|
// padding: EdgeInsets.all(15.h),
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
// '不支持5G WiFi网络,请选择2.4G WiFi网络进行配置'.tr,
|
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
|
// color: AppColors.darkGrayTextColor, fontSize: 20.sp),
|
|
|
|
|
|
// )),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
Expanded(
|
|
|
|
|
|
child: ListView(
|
2024-07-31 20:02:38 +08:00
|
|
|
|
children: <Widget>[
|
2023-07-27 15:26:30 +08:00
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: 'WiFi名称'.tr,
|
2024-09-19 09:26:07 +08:00
|
|
|
|
rightTitle: '',
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
allHeight: 80.h,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
isHaveLine: true,
|
2024-12-13 10:59:42 +08:00
|
|
|
|
rightWidget: getTFWidget(state.wifiNameTF, '请输入wifi名称'.tr)),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: 'WiFi密码'.tr,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
rightTitle: '',
|
2023-07-27 15:26:30 +08:00
|
|
|
|
isHaveRightWidget: true,
|
2024-12-13 10:59:42 +08:00
|
|
|
|
rightWidget:
|
|
|
|
|
|
getTFWidget(state.wifiPasswardTF, '请输入WiFi密码'.tr)),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 10.h,
|
|
|
|
|
|
),
|
|
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '网关名称'.tr,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
rightTitle: '',
|
2023-07-27 15:26:30 +08:00
|
|
|
|
isHaveRightWidget: true,
|
2024-12-13 10:59:42 +08:00
|
|
|
|
rightWidget:
|
|
|
|
|
|
getTFWidget(state.gatewayNameTF, '请输入网关名称'.tr)),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 10.h,
|
|
|
|
|
|
),
|
2024-10-07 14:17:46 +08:00
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '网络MAC'.tr,
|
2024-10-08 18:22:31 +08:00
|
|
|
|
rightTitle: state.gatewayModel.mac,
|
2024-08-19 11:01:37 +08:00
|
|
|
|
// allHeight: 100.h,
|
2024-10-07 14:17:46 +08:00
|
|
|
|
isHaveLine: false),
|
2024-09-19 09:26:07 +08:00
|
|
|
|
// SizedBox(
|
|
|
|
|
|
// height: 10.h,
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// Obx(() => Visibility(
|
|
|
|
|
|
// visible: state.isUseStaticIP.value,
|
|
|
|
|
|
// child: Column(
|
|
|
|
|
|
// children: <Widget>[
|
|
|
|
|
|
// CommonItem(
|
|
|
|
|
|
// leftTitel: 'IP地址'.tr,
|
|
|
|
|
|
// // rightTitle: '192.168.1.1',
|
|
|
|
|
|
// isHaveLine: true,
|
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
|
// rightWidget: getTFWidget(state.ipAddressTF, '请输入IP地址'.tr)
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// CommonItem(
|
|
|
|
|
|
// leftTitel: '子网掩码'.tr,
|
|
|
|
|
|
// // rightTitle: '255.255.255.0',
|
|
|
|
|
|
// isHaveLine: true,
|
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
|
// rightWidget: getTFWidget(state.subnetMaskTF, '请输入子网掩码'.tr)),
|
|
|
|
|
|
// CommonItem(
|
|
|
|
|
|
// leftTitel: '默认网关'.tr,
|
|
|
|
|
|
// // rightTitle: '192.168.1.1',
|
|
|
|
|
|
// isHaveLine: true,
|
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
|
// rightWidget: getTFWidget(state.defaultGatewayTF, '请输入默认网关'.tr)
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// SizedBox(height: 10.h,),
|
|
|
|
|
|
// Obx(() => CommonItem(
|
|
|
|
|
|
// leftTitel: '自动获取DNS服务器地址'.tr,
|
|
|
|
|
|
// rightTitle: '',
|
|
|
|
|
|
// isHaveLine: true,
|
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
|
// rightWidget: SizedBox(
|
|
|
|
|
|
// width: 60.w, height: 50.h, child: _switch()))),
|
|
|
|
|
|
// Visibility(
|
|
|
|
|
|
// visible: !state.isAutomaticallyGetDNSServerAddress.value,
|
|
|
|
|
|
// child: Column(
|
|
|
|
|
|
// children: <Widget>[
|
|
|
|
|
|
// CommonItem(
|
|
|
|
|
|
// leftTitel: '首选DNS'.tr,
|
|
|
|
|
|
// rightTitle: '',
|
|
|
|
|
|
// isHaveLine: true,
|
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
|
// rightWidget: getTFWidget(
|
|
|
|
|
|
// state.firstChoiceDNSTF,
|
|
|
|
|
|
// '请输入'.tr)),
|
|
|
|
|
|
// CommonItem(
|
|
|
|
|
|
// leftTitel: '备选DNS'.tr,
|
|
|
|
|
|
// rightTitle: '',
|
|
|
|
|
|
// isHaveLine: false,
|
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
|
// rightWidget: getTFWidget(
|
|
|
|
|
|
// state.alternativeDNSTF,
|
|
|
|
|
|
// '请输入'.tr,)),
|
|
|
|
|
|
// ],
|
|
|
|
|
|
// )),
|
|
|
|
|
|
// ],
|
|
|
|
|
|
// ))),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
SizedBox(height: 50.h),
|
2023-07-29 17:04:03 +08:00
|
|
|
|
Container(
|
|
|
|
|
|
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
|
|
|
|
|
child: SubmitBtn(
|
2024-07-26 09:21:22 +08:00
|
|
|
|
btnName: '确定'.tr,
|
2023-07-29 17:04:03 +08:00
|
|
|
|
borderRadius: 20.w,
|
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
|
left: 30.w, right: 30.w, top: 20.w, bottom: 20.w),
|
|
|
|
|
|
padding: EdgeInsets.only(top: 15.w, bottom: 15.w),
|
|
|
|
|
|
onClick: () {
|
2024-01-23 17:48:06 +08:00
|
|
|
|
// Navigator.pushNamed(context, Routers.selectGatewayPage);
|
2024-09-19 09:26:07 +08:00
|
|
|
|
logic.senderConfiguringWifiAction();
|
2023-07-29 17:04:03 +08:00
|
|
|
|
}),
|
|
|
|
|
|
),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
SizedBox(height: 10.h),
|
2024-09-14 16:31:45 +08:00
|
|
|
|
// Row(
|
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
// children: <Widget>[
|
|
|
|
|
|
// Obx(() => GestureDetector(
|
|
|
|
|
|
// child: SizedBox(
|
|
|
|
|
|
// // width: 150.w,
|
|
|
|
|
|
// height: 50.h,
|
|
|
|
|
|
// // color: Colors.red,
|
|
|
|
|
|
// child: Center(
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
// state.isUseStaticIP.value
|
|
|
|
|
|
// ? '不使用静态IP'.tr
|
|
|
|
|
|
// : '使用静态IP'.tr,
|
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
|
// fontSize: 22.sp, color: AppColors.mainColor)),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// onTap: () {
|
|
|
|
|
|
// state.isUseStaticIP.value = !state.isUseStaticIP.value;
|
|
|
|
|
|
//
|
|
|
|
|
|
// },
|
|
|
|
|
|
// )),
|
|
|
|
|
|
// SizedBox(width: 30.w),
|
|
|
|
|
|
// ],
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// SizedBox(
|
|
|
|
|
|
// height: 50.h,
|
|
|
|
|
|
// ),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
],
|
2023-07-18 18:10:57 +08:00
|
|
|
|
),
|
|
|
|
|
|
)
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 接受者信息输入框
|
2023-07-27 15:26:30 +08:00
|
|
|
|
Widget getTFWidget(TextEditingController controller, String tfStr) {
|
2023-07-18 18:10:57 +08:00
|
|
|
|
return SizedBox(
|
|
|
|
|
|
height: 50.h,
|
2023-07-29 17:04:03 +08:00
|
|
|
|
width: 300.w,
|
2023-07-18 18:10:57 +08:00
|
|
|
|
child: Row(
|
2024-07-31 20:02:38 +08:00
|
|
|
|
children: <Widget>[
|
2023-07-18 18:10:57 +08:00
|
|
|
|
Expanded(
|
|
|
|
|
|
child: TextField(
|
2024-09-19 09:26:07 +08:00
|
|
|
|
// 设置TextField font大小
|
2023-07-18 18:10:57 +08:00
|
|
|
|
//输入框一行
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
|
controller: controller,
|
|
|
|
|
|
autofocus: false,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
textAlign: TextAlign.end,
|
2024-09-19 09:26:07 +08:00
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 22.sp, // 设置字体大小
|
|
|
|
|
|
),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
|
//输入里面输入文字内边距设置
|
|
|
|
|
|
hintText: tfStr,
|
2023-07-29 17:04:03 +08:00
|
|
|
|
hintStyle: TextStyle(fontSize: 22.sp),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
focusedBorder: const OutlineInputBorder(
|
|
|
|
|
|
borderSide:
|
2024-12-13 10:59:42 +08:00
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
disabledBorder: const OutlineInputBorder(
|
|
|
|
|
|
borderSide:
|
2024-12-13 10:59:42 +08:00
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
enabledBorder: const OutlineInputBorder(
|
|
|
|
|
|
borderSide:
|
2024-12-13 10:59:42 +08:00
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
border: const OutlineInputBorder(
|
|
|
|
|
|
borderSide:
|
2024-12-13 10:59:42 +08:00
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
width: 10.w,
|
|
|
|
|
|
),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-19 09:26:07 +08:00
|
|
|
|
// CupertinoSwitch _switch() {
|
|
|
|
|
|
// return CupertinoSwitch(
|
|
|
|
|
|
// activeColor: CupertinoColors.activeBlue,
|
|
|
|
|
|
// trackColor: CupertinoColors.systemGrey5,
|
|
|
|
|
|
// thumbColor: CupertinoColors.white,
|
|
|
|
|
|
// value: state.isAutomaticallyGetDNSServerAddress.value,
|
|
|
|
|
|
// onChanged: (bool value) {
|
|
|
|
|
|
// state.isAutomaticallyGetDNSServerAddress.value = !state.isAutomaticallyGetDNSServerAddress.value;
|
|
|
|
|
|
// },
|
|
|
|
|
|
// );
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void didChangeDependencies() {
|
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
|
|
|
|
|
|
|
/// 路由订阅
|
|
|
|
|
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
/// 取消路由订阅
|
|
|
|
|
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 从上级界面进入 当前界面即将出现
|
|
|
|
|
|
@override
|
|
|
|
|
|
void didPush() {
|
|
|
|
|
|
super.didPush();
|
|
|
|
|
|
state.ifCurrentScreen.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 返回上一个界面 当前界面即将消失
|
|
|
|
|
|
@override
|
|
|
|
|
|
void didPop() {
|
|
|
|
|
|
super.didPop();
|
|
|
|
|
|
logic.cancelBlueConnetctToastTimer();
|
|
|
|
|
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
|
|
|
|
|
state.ifCurrentScreen.value = false;
|
|
|
|
|
|
state.sureBtnState.value = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 从下级返回 当前界面即将出现
|
|
|
|
|
|
@override
|
|
|
|
|
|
void didPopNext() {
|
|
|
|
|
|
super.didPopNext();
|
|
|
|
|
|
state.ifCurrentScreen.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 进入下级界面 当前界面即将消失
|
|
|
|
|
|
@override
|
|
|
|
|
|
void didPushNext() {
|
|
|
|
|
|
super.didPushNext();
|
|
|
|
|
|
logic.cancelBlueConnetctToastTimer();
|
|
|
|
|
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
|
|
|
|
|
state.ifCurrentScreen.value = false;
|
|
|
|
|
|
state.sureBtnState.value = 0;
|
2023-07-18 18:10:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|