Fix type error in ModernGlassButton onPressed: provide always non-null callback with permission check inside

This commit is contained in:
Leon Bösche
2026-01-24 03:51:51 +01:00
parent 1f7f4f33cc
commit 01d3ef8a46

View File

@@ -517,15 +517,28 @@ class _OrganizationSettingsDialogState
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
ModernGlassButton( ModernGlassButton(
onPressed: _canManage ? () { onPressed: () {
final username = usernameController.text.trim(); if (_canManage) {
if (username.isNotEmpty) { final username = usernameController.text.trim();
_inviteUser(username, selectedRole); if (username.isNotEmpty) {
usernameController.clear(); _inviteUser(username, selectedRole);
usernameController.clear();
}
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
'You do not have permission to send invitations',
),
),
);
} }
} : null, },
child: const Text('Send Invitation'), child: const Text('Send Invitation'),
), ),
// Invite link section
if (_inviteLink != null) ...[
const Divider(), const Divider(),
Text( Text(
'Invite Link', 'Invite Link',