2023-07-27 15:26:30 +08:00
|
|
|
|
import 'package:flutter/cupertino.dart';
|
2023-07-18 18:10:57 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
|
|
|
|
import '../../../../tools/commonItem.dart';
|
|
|
|
|
|
import '../../../../tools/submitBtn.dart';
|
|
|
|
|
|
import '../../../../tools/titleAppBar.dart';
|
|
|
|
|
|
import '../../../../translations/trans_lib.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-07-31 20:02:38 +08:00
|
|
|
|
class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiPage> {
|
2024-08-19 11:01:37 +08:00
|
|
|
|
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-07-31 20:02:38 +08:00
|
|
|
|
rightTitle: 'XinHongJia',
|
2023-07-27 15:26:30 +08:00
|
|
|
|
allHeight: 100.h,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
// Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage);
|
|
|
|
|
|
}),
|
|
|
|
|
|
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,
|
|
|
|
|
|
rightWidget: getTFWidget(
|
2024-08-19 11:01:37 +08:00
|
|
|
|
state.wifiPasswardTF,
|
2024-08-01 18:54:32 +08:00
|
|
|
|
'请输入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-08-19 11:01:37 +08:00
|
|
|
|
rightWidget: getTFWidget(state.gatewayNamePasswardTF,
|
2024-08-01 18:54:32 +08:00
|
|
|
|
'请输入网关名称'.tr)),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 10.h,
|
|
|
|
|
|
),
|
|
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '网络MAC'.tr,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
rightTitle: '48:55:19:7d:84:7a',
|
2024-08-19 11:01:37 +08:00
|
|
|
|
// allHeight: 100.h,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
isHaveLine: false),
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 10.h,
|
|
|
|
|
|
),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
Obx(() => Visibility(
|
|
|
|
|
|
visible: state.isUseStaticIP.value,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
child: Column(
|
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: 'IP地址'.tr,
|
2024-08-19 11:01:37 +08:00
|
|
|
|
// rightTitle: '192.168.1.1',
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: getTFWidget(state.ipAddressTF, '请输入IP地址')
|
|
|
|
|
|
),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '子网掩码'.tr,
|
2024-08-19 11:01:37 +08:00
|
|
|
|
// rightTitle: '255.255.255.0',
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: getTFWidget(state.subnetMaskTF, '请输入子网掩码')),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '默认网关'.tr,
|
2024-08-19 11:01:37 +08:00
|
|
|
|
// rightTitle: '192.168.1.1',
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: getTFWidget(state.defaultGatewayTF, '请输入默认网关')
|
2023-07-27 15:26:30 +08:00
|
|
|
|
),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
SizedBox(height: 10.h,),
|
|
|
|
|
|
Obx(() => CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '自动获取DNS服务器地址'.tr,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
rightTitle: '',
|
2023-07-27 15:26:30 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
2023-07-29 17:04:03 +08:00
|
|
|
|
rightWidget: SizedBox(
|
2024-08-19 11:01:37 +08:00
|
|
|
|
width: 60.w, height: 50.h, child: _switch()))),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
Visibility(
|
2024-08-19 11:01:37 +08:00
|
|
|
|
visible: !state.isAutomaticallyGetDNSServerAddress.value,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
child: Column(
|
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: '首选DNS'.tr,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
rightTitle: '',
|
2023-07-27 15:26:30 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: getTFWidget(
|
2024-08-19 11:01:37 +08:00
|
|
|
|
state.firstChoiceDNSTF,
|
|
|
|
|
|
'请输入'.tr)),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '备选DNS'.tr,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
rightTitle: '',
|
2023-07-27 15:26:30 +08:00
|
|
|
|
isHaveLine: false,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: getTFWidget(
|
2024-08-19 11:01:37 +08:00
|
|
|
|
state.alternativeDNSTF,
|
2024-07-26 09:21:22 +08:00
|
|
|
|
'请输入'.tr,)),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
],
|
|
|
|
|
|
)),
|
|
|
|
|
|
],
|
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);
|
2023-07-29 17:04:03 +08:00
|
|
|
|
}),
|
|
|
|
|
|
),
|
2024-08-19 11:01:37 +08:00
|
|
|
|
SizedBox(height: 10.h),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
Row(
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
children: <Widget>[
|
2024-08-19 11:01:37 +08:00
|
|
|
|
Obx(() => GestureDetector(
|
2023-07-27 15:26:30 +08:00
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
// width: 150.w,
|
|
|
|
|
|
height: 50.h,
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
child: Text(
|
2024-08-19 11:01:37 +08:00
|
|
|
|
state.isUseStaticIP.value
|
|
|
|
|
|
? '不使用静态IP'.tr
|
|
|
|
|
|
: '使用静态IP'.tr,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
style: TextStyle(
|
2023-07-29 17:04:03 +08:00
|
|
|
|
fontSize: 22.sp, color: AppColors.mainColor)),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
onTap: () {
|
2024-08-19 11:01:37 +08:00
|
|
|
|
state.isUseStaticIP.value = !state.isUseStaticIP.value;
|
|
|
|
|
|
|
2023-07-27 15:26:30 +08:00
|
|
|
|
},
|
2024-08-19 11:01:37 +08:00
|
|
|
|
)),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
SizedBox(width: 30.w),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 50.h,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
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(
|
|
|
|
|
|
//输入框一行
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
|
controller: controller,
|
|
|
|
|
|
autofocus: false,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
textAlign: TextAlign.end,
|
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:
|
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
|
|
|
|
|
disabledBorder: const OutlineInputBorder(
|
|
|
|
|
|
borderSide:
|
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
|
|
|
|
|
enabledBorder: const OutlineInputBorder(
|
|
|
|
|
|
borderSide:
|
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
|
|
|
|
|
border: const OutlineInputBorder(
|
|
|
|
|
|
borderSide:
|
|
|
|
|
|
BorderSide(width: 0, color: Colors.transparent)),
|
|
|
|
|
|
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
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-27 15:26:30 +08:00
|
|
|
|
CupertinoSwitch _switch() {
|
|
|
|
|
|
return CupertinoSwitch(
|
|
|
|
|
|
activeColor: CupertinoColors.activeBlue,
|
|
|
|
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
|
|
|
|
thumbColor: CupertinoColors.white,
|
2024-08-19 11:01:37 +08:00
|
|
|
|
value: state.isAutomaticallyGetDNSServerAddress.value,
|
2024-07-31 20:02:38 +08:00
|
|
|
|
onChanged: (bool value) {
|
2024-08-19 11:01:37 +08:00
|
|
|
|
state.isAutomaticallyGetDNSServerAddress.value = !state.isAutomaticallyGetDNSServerAddress.value;
|
2023-07-27 15:26:30 +08:00
|
|
|
|
},
|
2023-07-18 18:10:57 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|