add_new_user_dialog

This commit is contained in:
mohammad
2024-12-29 09:52:13 +03:00
parent ed2187b7ff
commit c834ad0670
2 changed files with 69 additions and 14 deletions

View File

@ -199,7 +199,6 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
node.title.toLowerCase().contains(searchTerm.toLowerCase()); node.title.toLowerCase().contains(searchTerm.toLowerCase());
bool childMatch = _searchRolePermission(node.subOptions, searchTerm); bool childMatch = _searchRolePermission(node.subOptions, searchTerm);
node.isHighlighted = isMatch || childMatch; node.isHighlighted = isMatch || childMatch;
anyMatch = anyMatch || node.isHighlighted; anyMatch = anyMatch || node.isHighlighted;
} }
return anyMatch; return anyMatch;

View File

@ -208,22 +208,52 @@ class _PermissionManagementState extends State<PermissionManagement> {
itemCount: subOption.subOptions.length, itemCount: subOption.subOptions.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final child = subOption.subOptions[index]; final child = subOption.subOptions[index];
return CheckboxListTile( return Container(
selectedTileColor: child.isHighlighted color: option.isHighlighted
? Colors.blue.shade50 ? Colors.blue.shade50
: Colors.white, : Colors.white,
dense: true, child: Row(
controlAffinity: ListTileControlAffinity.leading, children: [
title: Text( Builder(
builder: (context) {
final checkState =
checkifOneOfthemChecked(PermissionOption(
id: child.id,
title: child.title,
subOptions: [child],
));
if (checkState == CheckState.all) {
return Image.asset(
Assets.CheckBoxChecked,
width: 20,
height: 20,
);
} else if (checkState == CheckState.some) {
return Image.asset(
Assets.rectangleCheckBox,
width: 20,
height: 20,
);
} else {
return Image.asset(
Assets.emptyBox,
width: 20,
height: 20,
);
}
},
),
const SizedBox(width: 8),
Text(
child.title, child.title,
style: context.textTheme.bodyMedium?.copyWith( style: context.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 12, fontSize: 12,
color: ColorsManager.lightGreyColor), color: ColorsManager.lightGreyColor),
), ),
value: child.isChecked, ],
onChanged: (value) => toggleOptionById(child.id), ),
enabled: false,
); );
}, },
), ),
@ -237,3 +267,29 @@ class _PermissionManagementState extends State<PermissionManagement> {
); );
} }
} }
// Container(
// height: 50,
// width: 120,
// child: CheckboxListTile(
// activeColor: ColorsManager.dialogBlueTitle,
// selectedTileColor: child.isHighlighted
// ? Colors.blue.shade50
// : Colors.white,
// dense: true,
// controlAffinity:
// ListTileControlAffinity.leading,
// title: Text(
// child.title,
// style: context.textTheme.bodyMedium?.copyWith(
// fontWeight: FontWeight.w400,
// fontSize: 12,
// color: ColorsManager.lightGreyColor),
// ),
// value: child.isChecked,
// onChanged: (value) =>
// toggleOptionById(child.id),
// enabled: false,
// ),
// ),