135 lines
4.6 KiB
Dart
Executable File
135 lines
4.6 KiB
Dart
Executable File
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/noData.dart';
|
|
import '../../../tools/titleAppBar.dart';
|
|
import 'gatewayConnectionLockList_entity.dart';
|
|
import 'gatewayConnectionLockList_logic.dart';
|
|
import 'gatewayConnectionLockList_state.dart';
|
|
|
|
class GatewayConnectionLockListPage extends StatefulWidget {
|
|
const GatewayConnectionLockListPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<GatewayConnectionLockListPage> createState() =>
|
|
_GatewayConnectionLockListPageState();
|
|
}
|
|
|
|
class _GatewayConnectionLockListPageState
|
|
extends State<GatewayConnectionLockListPage> {
|
|
final GatewayConnectionLockListLogic logic =
|
|
Get.put(GatewayConnectionLockListLogic());
|
|
final GatewayConnectionLockListState state =
|
|
Get.find<GatewayConnectionLockListLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: '网关'.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor,
|
|
actionsList: [
|
|
TextButton(
|
|
onPressed: logic.gatewayScanDevice,
|
|
child: Text('扫描设备'.tr,
|
|
style: TextStyle(color: Colors.white, fontSize: 22.sp)))
|
|
],
|
|
),
|
|
body: Column(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 1.sw,
|
|
color: Colors.grey.shade300,
|
|
padding: EdgeInsets.all(10.h),
|
|
child: Text('网关连接的锁'.tr, style: TextStyle(fontSize: 24.sp))),
|
|
Obx(() => Expanded(
|
|
child: state.itemDataList.value.isNotEmpty
|
|
? ListView.builder(
|
|
itemCount: state.itemDataList.value.length,
|
|
itemBuilder: (BuildContext c, int index) {
|
|
final GatewayConnectionLockItemEntity entity =
|
|
state.itemDataList[index];
|
|
return _gatewayConnectionLockListItem(
|
|
'images/mine/icon_mine_gatewaySignal_prompt.png',
|
|
entity.lockAlias ?? '',
|
|
entity.gatewayRssi.toString(), () {
|
|
// Navigator.pushNamed(context, Routers.gatewayDetailPage);
|
|
});
|
|
})
|
|
: NoData(),
|
|
))
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _gatewayConnectionLockListItem(String lockTypeIcon, String gateWayName,
|
|
String signalStrength, Function() action) {
|
|
return GestureDetector(
|
|
onTap: action,
|
|
child: Container(
|
|
// height: 100.h,
|
|
margin: const EdgeInsets.only(bottom: 2),
|
|
padding:
|
|
EdgeInsets.only(left: 15.w, right: 20.w, top: 15.h, bottom: 15.h),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10.w),
|
|
),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Image.asset(
|
|
lockTypeIcon,
|
|
width: 70.w,
|
|
height: 70.w,
|
|
),
|
|
SizedBox(
|
|
width: 20.w,
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
Text(gateWayName,
|
|
style: TextStyle(
|
|
fontSize: 24.sp, fontWeight: FontWeight.w500)),
|
|
],
|
|
),
|
|
SizedBox(height: 5.h),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
Image.asset(
|
|
'images/mine/icon_mine_gatewaySignal_strong.png',
|
|
width: 30.w,
|
|
height: 30.w,
|
|
),
|
|
SizedBox(
|
|
width: 10.w,
|
|
),
|
|
Text(
|
|
signalStrength,
|
|
style: TextStyle(
|
|
fontSize: 22.sp, fontWeight: FontWeight.w500),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(width: 20.h),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(width: 20.h),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|