Merge pull request #89 from SyncrowIOT/disable_edit

disable_edit_user
This commit is contained in:
mohammadnemer1
2025-02-06 11:17:14 +03:00
committed by GitHub

View File

@ -25,7 +25,8 @@ class UsersPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final TextEditingController searchController = TextEditingController(); final TextEditingController searchController = TextEditingController();
Widget actionButton({required String title, required Function()? onTap}) { Widget actionButton(
{bool isActive = false, required String title, Function()? onTap}) {
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
child: Padding( child: Padding(
@ -33,9 +34,11 @@ class UsersPage extends StatelessWidget {
child: Text( child: Text(
title, title,
style: Theme.of(context).textTheme.bodySmall?.copyWith( style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: title == "Delete" color: isActive == false && title != "Delete"
? ColorsManager.red ? Colors.grey
: ColorsManager.spaceColor, : title == "Delete"
? ColorsManager.red
: ColorsManager.spaceColor,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
), ),
@ -444,24 +447,30 @@ class UsersPage extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
actionButton( user.isEnabled != false
title: "Edit", ? actionButton(
onTap: () { isActive: true,
showDialog( title: "Edit",
context: context, onTap: () {
barrierDismissible: false, showDialog(
builder: (BuildContext context) { context: context,
return EditUserDialog(userId: user.uuid); barrierDismissible: false,
}, builder: (BuildContext context) {
).then((v) { return EditUserDialog(
if (v != null) { userId: user.uuid);
if (v != null) { },
_blocRole.add(const GetUsers()); ).then((v) {
} if (v != null) {
} if (v != null) {
}); _blocRole.add(const GetUsers());
}, }
), }
});
},
)
: actionButton(
title: "Edit",
),
actionButton( actionButton(
title: "Delete", title: "Delete",
onTap: () { onTap: () {