1、添加网关列表调用接口
2、添加扫描网关逻辑
This commit is contained in:
parent
bb97183c18
commit
bcb7643a08
@ -150,34 +150,34 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
// mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
// children: <Widget>[
|
||||||
Obx(() => GestureDetector(
|
// Obx(() => GestureDetector(
|
||||||
child: SizedBox(
|
// child: SizedBox(
|
||||||
// width: 150.w,
|
// // width: 150.w,
|
||||||
height: 50.h,
|
// height: 50.h,
|
||||||
// color: Colors.red,
|
// // color: Colors.red,
|
||||||
child: Center(
|
// child: Center(
|
||||||
child: Text(
|
// child: Text(
|
||||||
state.isUseStaticIP.value
|
// state.isUseStaticIP.value
|
||||||
? '不使用静态IP'.tr
|
// ? '不使用静态IP'.tr
|
||||||
: '使用静态IP'.tr,
|
// : '使用静态IP'.tr,
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: 22.sp, color: AppColors.mainColor)),
|
// fontSize: 22.sp, color: AppColors.mainColor)),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
state.isUseStaticIP.value = !state.isUseStaticIP.value;
|
// state.isUseStaticIP.value = !state.isUseStaticIP.value;
|
||||||
|
//
|
||||||
},
|
// },
|
||||||
)),
|
// )),
|
||||||
SizedBox(width: 30.w),
|
// SizedBox(width: 30.w),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
SizedBox(
|
// SizedBox(
|
||||||
height: 50.h,
|
// height: 50.h,
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_settings.dart';
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../widget/permission/permission_dialog.dart';
|
||||||
|
import 'selectGatewayList_state.dart';
|
||||||
|
|
||||||
|
class SelectGatewayListLogic extends BaseGetXController {
|
||||||
|
SelectGatewayListState state = SelectGatewayListState();
|
||||||
|
|
||||||
|
void startScanBlueList() {
|
||||||
|
BlueManage().startScan(2000, (List<ScanResult> list) {
|
||||||
|
state.devices.clear();
|
||||||
|
for (int i = 0; i < list.length; i++) {
|
||||||
|
final ScanResult device = list[i];
|
||||||
|
// if ((device.advertisementData.serviceUuids.isNotEmpty
|
||||||
|
// ? device.advertisementData.serviceUuids[0]
|
||||||
|
// : '')
|
||||||
|
// .toString()[31] !=
|
||||||
|
// '1') {
|
||||||
|
state.devices.add(list[i]);
|
||||||
|
// AppLog.log('device:${list[i]}');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getNearByLimits() async {
|
||||||
|
if (!Platform.isIOS) {
|
||||||
|
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
|
||||||
|
final bool locationRequest = await PermissionDialog.request(Permission.location);
|
||||||
|
AppLog.log('locationRequest:$locationRequest');
|
||||||
|
if (!bluetoothRequest || !locationRequest) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startScanBlueList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点击连接设备
|
||||||
|
void connect(String deviceName) {
|
||||||
|
BlueManage().blueSendData(deviceName, (BluetoothConnectionState state) async {
|
||||||
|
// AppLog.log('点击要添加的设备了');
|
||||||
|
if (state == BluetoothConnectionState.connected) {
|
||||||
|
Get.toNamed(Routers.gatewayConfigurationWifiPage);
|
||||||
|
} else if (state == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
}
|
||||||
|
}, isAddEquipment: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
getNearByLimits();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,15 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import 'selectGatewayList_logic.dart';
|
||||||
|
import 'selectGatewayList_state.dart';
|
||||||
|
|
||||||
class SelectGatewayListPage extends StatefulWidget {
|
class SelectGatewayListPage extends StatefulWidget {
|
||||||
const SelectGatewayListPage({Key? key}) : super(key: key);
|
const SelectGatewayListPage({Key? key}) : super(key: key);
|
||||||
@ -15,6 +19,9 @@ class SelectGatewayListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SelectGatewayListPageState extends State<SelectGatewayListPage> {
|
class _SelectGatewayListPageState extends State<SelectGatewayListPage> {
|
||||||
|
final SelectGatewayListLogic logic = Get.put(SelectGatewayListLogic());
|
||||||
|
final SelectGatewayListState state = Get.find<SelectGatewayListLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -23,22 +30,33 @@ class _SelectGatewayListPageState extends State<SelectGatewayListPage> {
|
|||||||
barTitle: '选择网关'.tr,
|
barTitle: '选择网关'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView.builder(
|
body:
|
||||||
itemCount: 10,
|
// ListView.builder(
|
||||||
itemBuilder: (c, index) {
|
// itemCount: 10,
|
||||||
return _selectGatewayListListItem(
|
// itemBuilder: (BuildContext c, int index) {
|
||||||
'images/mine/icon_mine_gatewayListMainIcon.png',
|
// return _selectGatewayListListItem(
|
||||||
'G2 41c21c',
|
// 'images/mine/icon_mine_gatewayListMainIcon.png',
|
||||||
'-34', () {
|
// 'G2 41c21c',
|
||||||
Navigator.pushNamed(
|
// '-34', () {
|
||||||
context, Routers.gatewayConfigurationWifiPage);
|
// Navigator.pushNamed(
|
||||||
|
// context, Routers.gatewayConfigurationWifiPage);
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
Obx(() =>
|
||||||
|
state.devices.isNotEmpty?
|
||||||
|
ListView.builder(
|
||||||
|
itemCount: state.devices.length,
|
||||||
|
itemBuilder: (BuildContext c, int index) {
|
||||||
|
final ScanResult device = state.devices[index];
|
||||||
|
return _selectGatewayListListItem(device, () {
|
||||||
|
logic.connect(device.advertisementData.advName);
|
||||||
});
|
});
|
||||||
}),
|
}):NoData()
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _selectGatewayListListItem(String lockTypeIcon, String gateWayName,
|
Widget _selectGatewayListListItem(ScanResult device, Function() action) {
|
||||||
String networkSignal, Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -56,7 +74,7 @@ class _SelectGatewayListPageState extends State<SelectGatewayListPage> {
|
|||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
lockTypeIcon,
|
'images/mine/icon_mine_gatewayListMainIcon.png',
|
||||||
width: 60.w,
|
width: 60.w,
|
||||||
height: 60.w,
|
height: 60.w,
|
||||||
),
|
),
|
||||||
@ -67,37 +85,32 @@ class _SelectGatewayListPageState extends State<SelectGatewayListPage> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Row(
|
||||||
// color: Colors.red,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
child: Row(
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
Text(
|
||||||
children: [
|
device.advertisementData.advName ?? '未知设备',
|
||||||
Text(
|
style: TextStyle(fontSize: 24.sp),
|
||||||
gateWayName,
|
),
|
||||||
style: TextStyle(fontSize: 24.sp),
|
],
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Container(
|
Row(
|
||||||
child: Row(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
children: [
|
||||||
children: [
|
Image.asset(
|
||||||
Image.asset(
|
'images/mine/icon_mine_gatewaySignal_strong.png',
|
||||||
'images/mine/icon_mine_gatewaySignal_strong.png',
|
width: 22.w,
|
||||||
width: 22.w,
|
height: 22.w,
|
||||||
height: 22.w,
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
width: 10.w,
|
||||||
width: 10.w,
|
),
|
||||||
),
|
Text(
|
||||||
Text(
|
device.rssi.toString(),
|
||||||
networkSignal,
|
style: TextStyle(fontSize: 22.sp),
|
||||||
style: TextStyle(fontSize: 22.sp),
|
),
|
||||||
),
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.h),
|
SizedBox(width: 20.h),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class SelectGatewayListState{
|
||||||
|
RxList<ScanResult> devices = <ScanResult>[].obs;
|
||||||
|
}
|
||||||
38
lib/mine/gateway/gatewayList/gatewayList_logic.dart
Normal file
38
lib/mine/gateway/gatewayList/gatewayList_logic.dart
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../network/api_repository.dart';
|
||||||
|
import '../../mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||||
|
import 'gatewayList_state.dart';
|
||||||
|
|
||||||
|
class GatewayListLogic extends BaseGetXController {
|
||||||
|
GatewayListState state = GatewayListState();
|
||||||
|
|
||||||
|
// 获取网关列表
|
||||||
|
Future<GetewayDataEntity> getGatewayListData(
|
||||||
|
{required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.getewayListData.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
final GetewayDataEntity entity = await ApiRepository.to.getGatewayListData(
|
||||||
|
pageNo: pageNo.toString(),
|
||||||
|
pageSize: pageSize,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// 更新数据列表
|
||||||
|
state.getewayListData.addAll(entity.data!.list!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,7 +4,11 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../tools/storage.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
|
import '../../mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||||
|
import 'gatewayList_logic.dart';
|
||||||
|
import 'gatewayList_state.dart';
|
||||||
|
|
||||||
class GatewayListPage extends StatefulWidget {
|
class GatewayListPage extends StatefulWidget {
|
||||||
const GatewayListPage({Key? key}) : super(key: key);
|
const GatewayListPage({Key? key}) : super(key: key);
|
||||||
@ -14,6 +18,27 @@ class GatewayListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _GatewayListPageState extends State<GatewayListPage> {
|
class _GatewayListPageState extends State<GatewayListPage> {
|
||||||
|
final GatewayListLogic logic = Get.put(GatewayListLogic());
|
||||||
|
final GatewayListState state = Get.find<GatewayListLogic>().state;
|
||||||
|
|
||||||
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
logic.getGatewayListData(isRefresh: isRefresh).then((GetewayDataEntity value) {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
getHttpData(isRefresh: true);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -22,7 +47,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
barTitle: '网关'.tr,
|
barTitle: '网关'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(Routers.selectGatewayTypeNextTipPage);
|
Get.toNamed(Routers.selectGatewayTypeNextTipPage);
|
||||||
@ -38,14 +63,11 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: ListView.separated(
|
body: ListView.separated(
|
||||||
itemCount: 5,
|
itemCount: state.getewayListData.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
return _gatewatListItem(
|
final GetewayItemData item = state.getewayListData[index];
|
||||||
'images/mine/icon_mine_gatewayListMainIcon.png',
|
return _gatewatListItem(item, () {
|
||||||
'',
|
Get.toNamed(Routers.gatewayDetailPage);
|
||||||
'',
|
|
||||||
'2', () {
|
|
||||||
Navigator.pushNamed(context, Routers.gatewayDetailPage);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
@ -60,8 +82,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _gatewatListItem(String lockTypeIcon, String gateWayName,
|
Widget _gatewatListItem(GetewayItemData getewayItemData, Function() action) {
|
||||||
String isOnline, String lockNumber, Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -74,12 +95,12 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
borderRadius: BorderRadius.circular(10.w),
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
lockTypeIcon,
|
'images/mine/icon_mine_gatewayListMainIcon.png',
|
||||||
width: 60.w,
|
width: 60.w,
|
||||||
height: 60.w,
|
height: 60.w,
|
||||||
),
|
),
|
||||||
@ -89,12 +110,12 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
gateWayName,
|
getewayItemData.gatewayName ?? '',
|
||||||
style: TextStyle(fontSize: 24.sp),
|
style: TextStyle(fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -102,7 +123,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/mine/icon_mine_gatewayListOnline.png',
|
'images/mine/icon_mine_gatewayListOnline.png',
|
||||||
width: 22.w,
|
width: 22.w,
|
||||||
@ -112,7 +133,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'',
|
getewayItemData.isOnline == 1 ? '在线' : '离线',
|
||||||
style: TextStyle(fontSize: 18.sp),
|
style: TextStyle(fontSize: 18.sp),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -127,7 +148,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
|
|||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'2',
|
getewayItemData.lockNum.toString(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp, fontWeight: FontWeight.w500),
|
fontSize: 18.sp, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
|
|||||||
9
lib/mine/gateway/gatewayList/gatewayList_state.dart
Normal file
9
lib/mine/gateway/gatewayList/gatewayList_state.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||||
|
|
||||||
|
class GatewayListState{
|
||||||
|
final RxList<GetewayItemData> getewayListData = <GetewayItemData>[].obs;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,8 +1,4 @@
|
|||||||
class GetewayDataEntity {
|
class GetewayDataEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
GetewayListData? data;
|
|
||||||
|
|
||||||
GetewayDataEntity(
|
GetewayDataEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -13,6 +9,10 @@ class GetewayDataEntity {
|
|||||||
errorMsg = json['errorMsg'];
|
errorMsg = json['errorMsg'];
|
||||||
data = json['data'] != null ? GetewayListData.fromJson(json['data']) : null;
|
data = json['data'] != null ? GetewayListData.fromJson(json['data']) : null;
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
GetewayListData? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -27,11 +27,6 @@ class GetewayDataEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class GetewayListData {
|
class GetewayListData {
|
||||||
List<GetewayItemData>? list;
|
|
||||||
int? pageNo;
|
|
||||||
int? pageSize;
|
|
||||||
int? pages;
|
|
||||||
int? total;
|
|
||||||
|
|
||||||
GetewayListData({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
GetewayListData({this.list, this.pageNo, this.pageSize, this.pages, this.total});
|
||||||
|
|
||||||
@ -47,6 +42,11 @@ class GetewayListData {
|
|||||||
pages = json['pages'];
|
pages = json['pages'];
|
||||||
total = json['total'];
|
total = json['total'];
|
||||||
}
|
}
|
||||||
|
List<GetewayItemData>? list;
|
||||||
|
int? pageNo;
|
||||||
|
int? pageSize;
|
||||||
|
int? pages;
|
||||||
|
int? total;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -62,50 +62,71 @@ class GetewayListData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class GetewayItemData {
|
class GetewayItemData {
|
||||||
String? serialNumber;
|
|
||||||
int? plugId;
|
|
||||||
String? plugName;
|
|
||||||
String? networkName;
|
|
||||||
int? lockNum;
|
|
||||||
String? plugMac;
|
|
||||||
String? networkMac;
|
|
||||||
int? isOnline;
|
|
||||||
String? plugVersion;
|
|
||||||
int? select = 0;
|
|
||||||
GetewayItemData(
|
GetewayItemData(
|
||||||
{this.serialNumber,
|
{this.serialNumber,
|
||||||
this.plugId,
|
this.gatewayMac,
|
||||||
this.plugName,
|
this.gatewayName,
|
||||||
|
this.gatewayType,
|
||||||
this.networkName,
|
this.networkName,
|
||||||
this.lockNum,
|
|
||||||
this.plugMac,
|
|
||||||
this.networkMac,
|
this.networkMac,
|
||||||
|
this.lockNum,
|
||||||
this.isOnline,
|
this.isOnline,
|
||||||
this.plugVersion});
|
this.firmwareInfo,
|
||||||
|
this.needUpgrade,
|
||||||
|
this.version,
|
||||||
|
this.gatewayId});
|
||||||
|
|
||||||
GetewayItemData.fromJson(Map<String, dynamic> json) {
|
GetewayItemData.fromJson(Map<String, dynamic> json) {
|
||||||
serialNumber = json['serialNumber'];
|
serialNumber = json['serialNumber'];
|
||||||
plugId = json['plugId'];
|
gatewayMac = json['gatewayMac'];
|
||||||
plugName = json['plugName'];
|
gatewayName = json['gatewayName'];
|
||||||
|
gatewayType = json['gatewayType'];
|
||||||
networkName = json['networkName'];
|
networkName = json['networkName'];
|
||||||
lockNum = json['lockNum'];
|
|
||||||
plugMac = json['plugMac'];
|
|
||||||
networkMac = json['networkMac'];
|
networkMac = json['networkMac'];
|
||||||
|
lockNum = json['lockNum'];
|
||||||
isOnline = json['isOnline'];
|
isOnline = json['isOnline'];
|
||||||
plugVersion = json['plugVersion'];
|
if (json['firmwareInfo'] != null) {
|
||||||
|
firmwareInfo = <Null>[];
|
||||||
|
json['firmwareInfo'].forEach((v) {
|
||||||
|
firmwareInfo!.add(v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
needUpgrade = json['needUpgrade'];
|
||||||
|
version = json['version'];
|
||||||
|
gatewayId = json['gatewayId'];
|
||||||
}
|
}
|
||||||
|
String? serialNumber;
|
||||||
|
String? gatewayMac;
|
||||||
|
String? gatewayName;
|
||||||
|
int? gatewayType;
|
||||||
|
String? networkName;
|
||||||
|
String? networkMac;
|
||||||
|
int? lockNum;
|
||||||
|
int? isOnline;
|
||||||
|
List? firmwareInfo;
|
||||||
|
int? needUpgrade;
|
||||||
|
String? version;
|
||||||
|
int? gatewayId;
|
||||||
|
int? select = 0;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['serialNumber'] = serialNumber;
|
data['serialNumber'] = serialNumber;
|
||||||
data['plugId'] = plugId;
|
data['gatewayMac'] = gatewayMac;
|
||||||
data['plugName'] = plugName;
|
data['gatewayName'] = gatewayName;
|
||||||
|
data['gatewayType'] = gatewayType;
|
||||||
data['networkName'] = networkName;
|
data['networkName'] = networkName;
|
||||||
data['lockNum'] = lockNum;
|
|
||||||
data['plugMac'] = plugMac;
|
|
||||||
data['networkMac'] = networkMac;
|
data['networkMac'] = networkMac;
|
||||||
|
data['lockNum'] = lockNum;
|
||||||
data['isOnline'] = isOnline;
|
data['isOnline'] = isOnline;
|
||||||
data['plugVersion'] = plugVersion;
|
if (firmwareInfo != null) {
|
||||||
|
data['firmwareInfo'] = firmwareInfo!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['needUpgrade'] = needUpgrade;
|
||||||
|
data['version'] = version;
|
||||||
|
data['gatewayId'] = gatewayId;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,7 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 16.w,
|
width: 16.w,
|
||||||
),
|
),
|
||||||
Text(getewayItemData.plugName!, style: TextStyle(fontSize: 24.sp),)
|
Text(getewayItemData.gatewayName!, style: TextStyle(fontSize: 24.sp),)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -143,7 +143,7 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
|||||||
for (final GetewayItemData element in state.getewayListData.value) {
|
for (final GetewayItemData element in state.getewayListData.value) {
|
||||||
if(element.select == 1){
|
if(element.select == 1){
|
||||||
isCanNext = true;
|
isCanNext = true;
|
||||||
idList.add(element.plugId);
|
idList.add(element.gatewayId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isCanNext == false){
|
if(isCanNext == false){
|
||||||
|
|||||||
@ -148,7 +148,7 @@ abstract class Api {
|
|||||||
final String transferLockURL = '/room/transfer'; // 转移智能锁
|
final String transferLockURL = '/room/transfer'; // 转移智能锁
|
||||||
final String removeBadLockURL = '/lock/removeBadLock'; // 移除坏锁
|
final String removeBadLockURL = '/lock/removeBadLock'; // 移除坏锁
|
||||||
|
|
||||||
final String gatewaykListURL = '/plug/list'; // 转网关列表
|
final String gatewaykListURL = '/gateway/list'; // 转网关列表
|
||||||
final String transferGatewayConfirmURL =
|
final String transferGatewayConfirmURL =
|
||||||
'/plug/transferPlugConfirm'; // 转移网关确认
|
'/plug/transferPlugConfirm'; // 转移网关确认
|
||||||
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
||||||
|
|||||||
@ -2605,6 +2605,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
// 'language': language,
|
// 'language': language,
|
||||||
}),
|
}),
|
||||||
isUnShowLoading: true);
|
isUnShowLoading: true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -2596,4 +2596,5 @@ class ApiRepository {
|
|||||||
);
|
);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user