Added tooltip to delete user button if user is admin
This commit is contained in:
parent
b755d60939
commit
0c1b4eb885
1 changed files with 15 additions and 3 deletions
|
|
@ -799,16 +799,28 @@ class UsersListPanel extends GetView<UserListPanelController> {
|
|||
|
||||
final isAdmin =
|
||||
adminList.any((element) => element.id == user.id);
|
||||
if (isAdmin) return const SizedBox();
|
||||
|
||||
return ElevatedButton.icon(
|
||||
final isCurrentUser =
|
||||
user.accessToken == ApiController.to.token;
|
||||
if (isCurrentUser) return const SizedBox();
|
||||
|
||||
final btn = ElevatedButton.icon(
|
||||
onPressed: () => controller.deleteUser(user),
|
||||
icon: const Icon(Icons.delete_forever),
|
||||
label: const Text("Delete user"),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.redAccent,
|
||||
),
|
||||
).paddingAll(8).expanded();
|
||||
);
|
||||
|
||||
if (isAdmin) {
|
||||
return Tooltip(
|
||||
message: "Please note that this user is an admin",
|
||||
child: btn,
|
||||
).paddingAll(8).expanded();
|
||||
}
|
||||
|
||||
return btn.paddingAll(8).expanded();
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue