app-starlock/lib/mine/gateway/gatewayConnectionLock/gatewayConnectionLockList_page.dart

135 lines
4.6 KiB
Dart
Raw Normal View History

2023-07-18 18:10:57 +08:00
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';
2023-07-18 18:10:57 +08:00
import '../../../tools/titleAppBar.dart';
import 'gatewayConnectionLockList_entity.dart';
import 'gatewayConnectionLockList_logic.dart';
import 'gatewayConnectionLockList_state.dart';
2023-07-18 18:10:57 +08:00
class GatewayConnectionLockListPage extends StatefulWidget {
const GatewayConnectionLockListPage({Key? key}) : super(key: key);
@override
State<GatewayConnectionLockListPage> createState() =>
_GatewayConnectionLockListPageState();
2023-07-18 18:10:57 +08:00
}
class _GatewayConnectionLockListPageState
extends State<GatewayConnectionLockListPage> {
final GatewayConnectionLockListLogic logic =
Get.put(GatewayConnectionLockListLogic());
final GatewayConnectionLockListState state =
Get.find<GatewayConnectionLockListLogic>().state;
2023-07-18 18:10:57 +08:00
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
2024-08-19 11:01:37 +08:00
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)))
],
2024-08-19 11:01:37 +08:00
),
2023-07-18 18:10:57 +08:00
body: Column(
children: <Widget>[
2023-07-18 18:10:57 +08:00
Container(
width: 1.sw,
color: Colors.grey.shade300,
2024-08-19 11:01:37 +08:00
padding: EdgeInsets.all(10.h),
child: Text('网关连接的锁'.tr, style: TextStyle(fontSize: 24.sp))),
Obx(() => Expanded(
child: state.itemDataList.value.isNotEmpty
? ListView.builder(
itemCount: 10,
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(),
))
2023-07-18 18:10:57 +08:00
],
),
);
}
Widget _gatewayConnectionLockListItem(String lockTypeIcon, String gateWayName,
String signalStrength, Function() action) {
2023-07-18 18:10:57 +08:00
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(
2023-07-18 18:10:57 +08:00
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,
),
2023-07-18 18:10:57 +08:00
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(gateWayName,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w500)),
],
2023-07-18 18:10:57 +08:00
),
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),
),
],
2023-07-18 18:10:57 +08:00
),
SizedBox(width: 20.h),
2023-07-18 18:10:57 +08:00
],
),
),
SizedBox(width: 20.h),
2023-07-18 18:10:57 +08:00
],
),
),
);
}
}