2023-08-01 09:47:03 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:star_lock/tools/submitBtn.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
|
|
|
import '../../../../tools/titleAppBar.dart';
|
|
|
|
|
|
|
|
|
|
class GetDeviceListPage extends StatefulWidget {
|
|
|
|
|
const GetDeviceListPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<GetDeviceListPage> createState() => _GetDeviceListPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _GetDeviceListPageState extends State<GetDeviceListPage> {
|
|
|
|
|
bool isNameSelect = false;
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
|
|
|
appBar: TitleAppBar(
|
2024-08-01 18:54:32 +08:00
|
|
|
barTitle: '关联设备'.tr,
|
2023-08-01 09:47:03 +08:00
|
|
|
haveBack: true,
|
|
|
|
|
backgroundColor: AppColors.mainColor,
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2024-06-03 13:50:07 +08:00
|
|
|
children: <Widget>[
|
2023-08-01 09:47:03 +08:00
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 30.w, top: 16.w, right: 30.w, bottom: 16.w),
|
|
|
|
|
child: Text(
|
2024-08-21 14:12:15 +08:00
|
|
|
'请选择姓名要关联哪些设备'.tr,
|
2023-08-01 09:47:03 +08:00
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.darkGrayTextColor, fontSize: 20.sp),
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(child: _permissionDeviceList()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设备列表
|
|
|
|
|
Widget _permissionDeviceList() {
|
|
|
|
|
return Column(
|
2024-06-03 13:50:07 +08:00
|
|
|
children: <Widget>[
|
2023-08-01 09:47:03 +08:00
|
|
|
Expanded(
|
|
|
|
|
child: ListView.separated(
|
2024-06-03 13:50:07 +08:00
|
|
|
itemBuilder: (BuildContext context, int index) {
|
2023-08-01 09:47:03 +08:00
|
|
|
if (index == 0) {
|
|
|
|
|
return _buildDeviceWidget(
|
2024-06-03 13:50:07 +08:00
|
|
|
context, index, 'images/icon_lock.png', '大门锁');
|
2023-08-01 09:47:03 +08:00
|
|
|
} else if (index == 1) {
|
|
|
|
|
return _buildDeviceWidget(
|
2024-06-03 13:50:07 +08:00
|
|
|
context, index, 'images/icon_lock.png', '办公室锁');
|
2023-08-01 09:47:03 +08:00
|
|
|
} else if (index == 2) {
|
|
|
|
|
return _buildDeviceWidget(
|
2024-06-03 13:50:07 +08:00
|
|
|
context, index, 'images/icon_lock.png', '会议室锁');
|
2023-08-01 09:47:03 +08:00
|
|
|
} else {
|
|
|
|
|
return _buildDeviceWidget(
|
2024-06-03 13:50:07 +08:00
|
|
|
context, index, 'images/icon_lock.png', '宴会厅锁');
|
2023-08-01 09:47:03 +08:00
|
|
|
}
|
|
|
|
|
},
|
2024-06-03 13:50:07 +08:00
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
2023-08-01 09:47:03 +08:00
|
|
|
return const Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
color: AppColors.greyLineColor,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
itemCount: 5)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20.h,
|
|
|
|
|
),
|
|
|
|
|
SubmitBtn(
|
2024-08-21 14:12:15 +08:00
|
|
|
btnName: '确定'.tr,
|
2023-08-01 09:47:03 +08:00
|
|
|
onClick: () {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40.h,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildDeviceWidget(context, index, imageName, deviceName) {
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 90.h,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
width: ScreenUtil().screenWidth,
|
|
|
|
|
child: Row(
|
2024-06-03 13:50:07 +08:00
|
|
|
children: <Widget>[
|
2023-08-01 09:47:03 +08:00
|
|
|
SizedBox(
|
|
|
|
|
width: 30.w,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
isNameSelect == false
|
2024-01-23 17:29:18 +08:00
|
|
|
? 'images/icon_round_unSelect.png'
|
2024-01-23 17:48:06 +08:00
|
|
|
: 'images/icon_round_select.png',
|
2023-08-01 09:47:03 +08:00
|
|
|
width: 30.sp,
|
|
|
|
|
height: 30.sp,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 20.w,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
imageName,
|
|
|
|
|
width: 36.w,
|
|
|
|
|
height: 36.w,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10.w,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
deviceName,
|
|
|
|
|
style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 30.w,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isNameSelect = !isNameSelect;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|