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,7 +34,9 @@ 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"
? Colors.grey
: title == "Delete"
? ColorsManager.red ? ColorsManager.red
: ColorsManager.spaceColor, : ColorsManager.spaceColor,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -444,14 +447,17 @@ class UsersPage extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
actionButton( user.isEnabled != false
? actionButton(
isActive: true,
title: "Edit", title: "Edit",
onTap: () { onTap: () {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (BuildContext context) { builder: (BuildContext context) {
return EditUserDialog(userId: user.uuid); return EditUserDialog(
userId: user.uuid);
}, },
).then((v) { ).then((v) {
if (v != null) { if (v != null) {
@ -461,6 +467,9 @@ class UsersPage extends StatelessWidget {
} }
}); });
}, },
)
: actionButton(
title: "Edit",
), ),
actionButton( actionButton(
title: "Delete", title: "Delete",