153 lines
4.6 KiB
Dart
153 lines
4.6 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
import '../../../../blue/blue_manage.dart';
|
|
import '../../../../tools/appRouteObserver.dart';
|
|
import '../../../../tools/commonItem.dart';
|
|
import '../../../../tools/submitBtn.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
import '../../../../translations/trans_lib.dart';
|
|
import 'configuringWifi_logic.dart';
|
|
|
|
class ConfiguringWifiPage extends StatefulWidget {
|
|
const ConfiguringWifiPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<ConfiguringWifiPage> createState() => _ConfiguringWifiPageState();
|
|
}
|
|
|
|
class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAware {
|
|
final logic = Get.put(ConfiguringWifiLogic());
|
|
final state = Get.find<ConfiguringWifiLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: TitleAppBar(
|
|
barTitle: TranslationLoader.lanKeys!.configuringWiFi!.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Column(
|
|
children: [
|
|
configuringWifiTFWidget(TranslationLoader.lanKeys!.wifiName!.tr, TranslationLoader.lanKeys!.pleaseEnterWifiName!.tr, state.wifiNameController),
|
|
Container(width: 1.sw, height: 1.h,color: AppColors.mainBackgroundColor),
|
|
configuringWifiTFWidget(TranslationLoader.lanKeys!.wifiPassward!.tr, TranslationLoader.lanKeys!.pleaseEnterWifiPwd!.tr, state.wifiPWDController),
|
|
SizedBox(height: 50.h,),
|
|
SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () {
|
|
logic.senderConfiguringWifiAction();
|
|
}),
|
|
],
|
|
));
|
|
}
|
|
|
|
Widget configuringWifiTFWidget(
|
|
String titleStr, String rightTitle,TextEditingController controller) {
|
|
return Column(
|
|
children: [
|
|
Container(height: 10.h),
|
|
CommonItem(
|
|
leftTitel: titleStr,
|
|
rightTitle: "",
|
|
isHaveRightWidget: true,
|
|
rightWidget: getTFWidget(rightTitle, controller)),
|
|
Container(height: 10.h),
|
|
],
|
|
);
|
|
}
|
|
|
|
// 接受者信息输入框
|
|
Widget getTFWidget(String tfStr, TextEditingController controller) {
|
|
return Container(
|
|
height: 50.h,
|
|
width: 300.w,
|
|
child: Row(
|
|
children: [
|
|
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: 24.sp),
|
|
//不需要输入框下划线
|
|
border: InputBorder.none,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 10.w,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
// TODO: implement didChangeDependencies
|
|
super.didChangeDependencies();
|
|
|
|
/// 路由订阅
|
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
// TODO: implement dispose
|
|
/// 取消路由订阅
|
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
|
super.dispose();
|
|
}
|
|
|
|
/// 从上级界面进入 当前界面即将出现
|
|
@override
|
|
void didPush() {
|
|
super.didPush();
|
|
print("lockSet===didPush");
|
|
state.ifCurrentScreen.value = true;
|
|
|
|
}
|
|
|
|
/// 返回上一个界面 当前界面即将消失
|
|
@override
|
|
void didPop() {
|
|
super.didPop();
|
|
print("lockSet===didPop");
|
|
logic.cancelBlueConnetctToastTimer();
|
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
|
BlueManage().stopScan();
|
|
state.ifCurrentScreen.value = false;
|
|
state.sureBtnState.value = 0;
|
|
}
|
|
|
|
/// 从下级返回 当前界面即将出现
|
|
@override
|
|
void didPopNext() {
|
|
super.didPopNext();
|
|
print("lockSet===didPopNext");
|
|
state.ifCurrentScreen.value = true;
|
|
}
|
|
|
|
/// 进入下级界面 当前界面即将消失
|
|
@override
|
|
void didPushNext() {
|
|
super.didPushNext();
|
|
print("lockSet===didPushNext");
|
|
logic.cancelBlueConnetctToastTimer();
|
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
|
BlueManage().stopScan();
|
|
state.ifCurrentScreen.value = false;
|
|
state.sureBtnState.value = 0;
|
|
}
|
|
}
|