114 lines
4.3 KiB
Dart
Executable File
114 lines
4.3 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../../appRouters.dart';
|
|
import '../../../app_settings/app_colors.dart';
|
|
import '../../../tools/commonItem.dart';
|
|
import '../../../tools/showTFView.dart';
|
|
import '../../../tools/showTipView.dart';
|
|
import '../../../tools/submitBtn.dart';
|
|
import '../../../tools/titleAppBar.dart';
|
|
import 'gatewayDetail_logic.dart';
|
|
import 'gatewayDetail_state.dart';
|
|
|
|
class GatewayDetailPage extends StatefulWidget {
|
|
const GatewayDetailPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<GatewayDetailPage> createState() => _GatewayDetailPageState();
|
|
}
|
|
|
|
class _GatewayDetailPageState extends State<GatewayDetailPage> {
|
|
final GatewayDetailLogic logic = Get.put(GatewayDetailLogic());
|
|
final GatewayDetailState state = Get.find<GatewayDetailLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: '网关'.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Obx(() => ListView(
|
|
children: <Widget>[
|
|
CommonItem(
|
|
leftTitel: '名称'.tr,
|
|
rightTitle: state.getewayItemData.value.gatewayName,
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
ShowTipView().showTFViewAlertDialog(
|
|
state.changeGatewayNameController,
|
|
'请输入姓名'.tr,
|
|
'请输入姓名'.tr, () {
|
|
if (state.changeGatewayNameController.text.isEmpty) {
|
|
logic.showToast('请输入姓名'.tr);
|
|
return;
|
|
}
|
|
Get.back();
|
|
logic.updateGateway(
|
|
state.changeGatewayNameController.text);
|
|
}, inputFormatters: <TextInputFormatter>[
|
|
FilteringTextInputFormatter.deny('\n'),
|
|
LengthLimitingTextInputFormatter(50),
|
|
]);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: '状态'.tr,
|
|
rightTitle: state.getewayItemData.value.isOnline == 1
|
|
? '在线'.tr
|
|
: '离线'.tr,
|
|
isHaveLine: true,
|
|
isHaveDirection: false),
|
|
CommonItem(
|
|
leftTitel: 'WiFi名称'.tr,
|
|
rightTitle: state.getewayItemData.value.networkName,
|
|
isHaveLine: true,
|
|
isHaveDirection: false),
|
|
CommonItem(
|
|
leftTitel: '网络MAC'.tr,
|
|
rightTitle: state.getewayItemData.value.gatewayMac,
|
|
isHaveLine: false,
|
|
isHaveDirection: false),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
CommonItem(
|
|
leftTitel: '附近的锁'.tr,
|
|
// rightTitle: state.getewayItemData.value.lockNum.toString(),
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.gatewayConnectionLockPage, arguments: {
|
|
'gatewayId': state.getewayItemData.value.gatewayId ?? 0
|
|
});
|
|
}),
|
|
// CommonItem(
|
|
// leftTitel: '网关升级'.tr,
|
|
// rightTitle: '',
|
|
// isHaveLine: false,
|
|
// isHaveDirection: true,
|
|
// action: () {}),
|
|
SizedBox(
|
|
height: 80.h,
|
|
),
|
|
SubmitBtn(
|
|
btnName: '删除'.tr,
|
|
isDelete: true,
|
|
borderRadius: 20.w,
|
|
fontSize: 32.sp,
|
|
margin: EdgeInsets.only(left: 30.w, right: 30.w),
|
|
padding: EdgeInsets.only(top: 15.w, bottom: 15.w),
|
|
onClick: () {
|
|
ShowTipView().showIosTipWithContentDialog(
|
|
'确定要删除吗?'.tr, () => logic.deletGateway(0));
|
|
}),
|
|
],
|
|
)),
|
|
);
|
|
}
|
|
}
|