99 lines
2.9 KiB
Dart
Executable File
99 lines
2.9 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
|
|
|
typedef _CallBack = void Function(int selectIndex, String selectLockId);
|
|
|
|
class massSendLockGroupCell extends StatelessWidget {
|
|
massSendLockGroupCell(int index,
|
|
{required this.currentIndex,
|
|
required this.lockListByGroup,
|
|
required this.selectLockAction,
|
|
required this.isVip,
|
|
required this.isShowBtn,
|
|
Key? key})
|
|
: super(key: key);
|
|
final int currentIndex;
|
|
List lockListByGroup;
|
|
final _CallBack selectLockAction;
|
|
bool isVip;
|
|
bool isShowBtn;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView.separated(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemCount: lockListByGroup.length,
|
|
itemBuilder: (_, int itemIndex) {
|
|
final LockListItem itemData = lockListByGroup[itemIndex];
|
|
return _itemBuilder(itemData, itemIndex);
|
|
},
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
return const Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _itemBuilder(LockListItem itemData, int itemIndex) {
|
|
return GestureDetector(
|
|
child: Container(
|
|
height: 60.h,
|
|
color: Colors.white,
|
|
width: 1.sw,
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 20.w,
|
|
),
|
|
Image.asset(
|
|
'images/mine/icon_mine_gatewaySignal_prompt.png',
|
|
width: 36.w,
|
|
height: 36.w,
|
|
),
|
|
SizedBox(
|
|
width: 5.w,
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
itemData.lockAlias!,
|
|
style: TextStyle(
|
|
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
SizedBox(width: 20.w),
|
|
// Expanded(
|
|
// child: SizedBox(
|
|
// width: 20.w,
|
|
// )),
|
|
Visibility(
|
|
visible: isShowBtn,
|
|
child: Image.asset(
|
|
itemData.isChecked
|
|
? 'images/icon_round_select.png'
|
|
: 'images/icon_round_unSelect.png',
|
|
width: 30.w,
|
|
height: 30.w,
|
|
color: !isVip ? Colors.grey : AppColors.mainColor,
|
|
),),
|
|
SizedBox(
|
|
width: 20.w,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
onTap: isShowBtn ? () {
|
|
if (isVip == false) {
|
|
return;
|
|
}
|
|
selectLockAction(itemIndex, itemData.lockId.toString());
|
|
} : null,
|
|
);
|
|
}
|
|
}
|