app-starlock/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart
2024-08-01 18:54:32 +08:00

233 lines
8.5 KiB
Dart
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/cupertino.dart';
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';
class GatewayConfigurationWifiPage extends StatefulWidget {
const GatewayConfigurationWifiPage({Key? key}) : super(key: key);
@override
State<GatewayConfigurationWifiPage> createState() =>
_GatewayConfigurationWifiPageState();
}
class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiPage> {
final TextEditingController _wifiPassward = TextEditingController();
final TextEditingController _gatewayNamePassward = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '网关'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: <Widget>[
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),
)),
Expanded(
child: ListView(
children: <Widget>[
CommonItem(
leftTitel: 'WiFi名称'.tr,
rightTitle: 'XinHongJia',
allHeight: 100.h,
isHaveLine: true,
isHaveDirection: true,
action: () {
// Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage);
}),
CommonItem(
leftTitel: 'WiFi密码'.tr,
rightTitle: '',
isHaveRightWidget: true,
rightWidget: getTFWidget(
_wifiPassward,
'请输入WiFi密码'.tr)),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: '网关名称'.tr,
rightTitle: '',
isHaveRightWidget: true,
rightWidget: getTFWidget(_gatewayNamePassward,
'请输入网关名称'.tr)),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: '网络MAC'.tr,
rightTitle: '48:55:19:7d:84:7a',
allHeight: 100.h,
isHaveLine: false),
SizedBox(
height: 10.h,
),
Visibility(
visible: true,
child: Column(
children: <Widget>[
CommonItem(
leftTitel: 'IP地址'.tr,
rightTitle: '192.168.1.1',
allHeight: 100.h,
isHaveLine: true),
CommonItem(
leftTitel: '子网掩码'.tr,
rightTitle: '255.255.255.0',
allHeight: 100.h,
isHaveLine: true),
CommonItem(
leftTitel: '默认网关'.tr,
rightTitle: '192.168.1.1',
allHeight: 100.h,
isHaveLine: true),
SizedBox(
height: 10.h,
),
CommonItem(
leftTitel: '自动获取DNS服务器地址'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w, height: 50.h, child: _switch())),
Visibility(
visible: true,
child: Column(
children: <Widget>[
CommonItem(
leftTitel: '首选DNS'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(
_gatewayNamePassward,
'请输入'.tr,)),
CommonItem(
leftTitel: '备选DNS'.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: getTFWidget(
_gatewayNamePassward,
'请输入'.tr,)),
],
)),
],
)),
SizedBox(
height: 50.h,
),
Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: SubmitBtn(
btnName: '确定'.tr,
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: () {
// Navigator.pushNamed(context, Routers.selectGatewayPage);
}),
),
SizedBox(
height: 10.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
GestureDetector(
child: SizedBox(
// width: 150.w,
height: 50.h,
// color: Colors.red,
child: Center(
child: Text(
'不使用静态IP'.tr,
style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor)),
),
),
onTap: () {
// Navigator.pushNamed(context, Routers.starLockForgetPasswordPage);
},
),
SizedBox(width: 30.w),
],
),
SizedBox(
height: 50.h,
),
],
),
)
],
),
);
}
// 接受者信息输入框
Widget getTFWidget(TextEditingController controller, String tfStr) {
return SizedBox(
height: 50.h,
width: 300.w,
child: Row(
children: <Widget>[
Expanded(
child: TextField(
//输入框一行
maxLines: 1,
controller: controller,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//输入里面输入文字内边距设置
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//不需要输入框下划线
border: InputBorder.none,
),
),
),
SizedBox(
width: 10.w,
),
],
),
);
}
CupertinoSwitch _switch() {
bool _isOn = false;
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: _isOn,
onChanged: (bool value) {
setState(() {
_isOn = value;
});
},
);
}
}