1,新增分组的接口地址
2,新增锁列表接口及部分页面
This commit is contained in:
parent
504f604ad0
commit
d783cd875a
@ -0,0 +1,163 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/utils.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/tools/ExpandedListView.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
class MassSendLockGroupListPage extends StatefulWidget {
|
||||
const MassSendLockGroupListPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _MassSendLockGroupListPageState();
|
||||
}
|
||||
}
|
||||
|
||||
class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColors.mainColor,
|
||||
title: Text(
|
||||
TranslationLoader.lanKeys!.authorityManagement!.tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Text(
|
||||
'请选择要发送的锁',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
||||
),
|
||||
_keyGroupList()
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
//设备列表
|
||||
Widget _keyGroupList() {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return _buildLockExpandedList(context, index, "大门锁");
|
||||
} else if (index == 1) {
|
||||
return _buildLockExpandedList(context, index, "办公室锁");
|
||||
} else if (index == 2) {
|
||||
return _buildLockExpandedList(context, index, "会议室锁");
|
||||
} else {
|
||||
return _buildLockExpandedList(context, index, "宴会厅锁");
|
||||
}
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
itemCount: 5)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
//设备多层级列表
|
||||
Widget _buildLockExpandedList(context, index, deviceName) {
|
||||
return ExpandedListTile(
|
||||
onTap: () => print("onTap."),
|
||||
title: deviceName,
|
||||
imgName: 'images/icon_lock.png',
|
||||
typeImgList: const [],
|
||||
child: ListView.separated(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: 10,
|
||||
itemBuilder: (_, index) {
|
||||
if (index == 0) {
|
||||
return _buildNameWidget(
|
||||
context, index, 'images/icon_password.png', '张三');
|
||||
} else if (index == 1) {
|
||||
return _buildNameWidget(
|
||||
context, index, 'images/icon_card.png', '李四');
|
||||
} else if (index == 2) {
|
||||
return _buildNameWidget(
|
||||
context, index, 'images/icon_fingerprint.png', '王二');
|
||||
} else if (index == 3) {
|
||||
return _buildNameWidget(
|
||||
context, index, 'images/icon_card.png', '麻子');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//单个姓名行
|
||||
Widget _buildNameWidget(context, index, imageName, getName) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
height: 60.h,
|
||||
color: Colors.white,
|
||||
width: ScreenUtil().screenWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/controls_user.png',
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
getName,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
// selectNameIndex = index;
|
||||
// setState(() {
|
||||
// if (selectNameIndex == index) {
|
||||
// isNameSelect = !isNameSelect;
|
||||
// }
|
||||
// });
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -35,4 +35,6 @@ abstract class Api {
|
||||
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
||||
final String lockGroupListURL = '/authorizedAdmin/listGroup'; //锁分组列表
|
||||
final String updateSettingURL = '/room/updateSetting'; //标记房态
|
||||
final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
||||
final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
||||
}
|
||||
|
||||
@ -342,6 +342,13 @@ class ApiProvider extends BaseProvider {
|
||||
Future<Response> updateSetting(String lockId, String isOn, String type) =>
|
||||
post(updateSettingURL.toUrl,
|
||||
jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type}));
|
||||
|
||||
Future<Response> keyGroupList(String type) =>
|
||||
post(keyGroupListURL.toUrl, jsonEncode({'type': type}));
|
||||
|
||||
Future<Response> lockListByGroup(String type, String keyGroupId) => post(
|
||||
lockListByGroupURL.toUrl,
|
||||
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
||||
}
|
||||
|
||||
extension ExtensionString on String {
|
||||
|
||||
@ -325,4 +325,17 @@ class ApiRepository {
|
||||
final res = await apiProvider.deleteKeyboardPwd(lockId, isOn, type);
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//分组列表
|
||||
Future<PasswordKeyEntity> keyGroupList(String type) async {
|
||||
final res = await apiProvider.keyGroupList(type);
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//分组下的锁
|
||||
Future<PasswordKeyEntity> lockListByGroup(
|
||||
String type, String keyGroupId) async {
|
||||
final res = await apiProvider.lockListByGroup(type, keyGroupId);
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user