Added placeholder for lastName and role addition functionality
This commit is contained in:
@@ -8,8 +8,11 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
class InvitationFormFields extends StatelessWidget {
|
||||
final List<RoleDescription> roles;
|
||||
final TextEditingController emailController;
|
||||
final TextEditingController nameController;
|
||||
final TextEditingController firstNameController;
|
||||
final TextEditingController lastNameController;
|
||||
final TextEditingController messageController;
|
||||
final bool canCreateRoles;
|
||||
final VoidCallback onCreateRole;
|
||||
final String? selectedRoleRef;
|
||||
final ValueChanged<String?> onRoleChanged;
|
||||
|
||||
@@ -17,8 +20,11 @@ class InvitationFormFields extends StatelessWidget {
|
||||
super.key,
|
||||
required this.roles,
|
||||
required this.emailController,
|
||||
required this.nameController,
|
||||
required this.firstNameController,
|
||||
required this.lastNameController,
|
||||
required this.messageController,
|
||||
required this.canCreateRoles,
|
||||
required this.onCreateRole,
|
||||
required this.selectedRoleRef,
|
||||
required this.onRoleChanged,
|
||||
});
|
||||
@@ -47,11 +53,21 @@ class InvitationFormFields extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 280,
|
||||
width: 200,
|
||||
child: TextFormField(
|
||||
controller: nameController,
|
||||
controller: firstNameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.invitationNameLabel,
|
||||
labelText: loc.firstName,
|
||||
prefixIcon: const Icon(Icons.person_outline),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 200,
|
||||
child: TextFormField(
|
||||
controller: lastNameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.lastName,
|
||||
prefixIcon: const Icon(Icons.person_outline),
|
||||
),
|
||||
),
|
||||
@@ -59,7 +75,7 @@ class InvitationFormFields extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: 260,
|
||||
child: DropdownButtonFormField<String>(
|
||||
initialValue: selectedRoleRef ?? (roles.isNotEmpty ? roles.first.storable.id : null),
|
||||
value: selectedRoleRef,
|
||||
items: roles.map((role) => DropdownMenuItem(
|
||||
value: role.storable.id,
|
||||
child: Text(role.describable.name),
|
||||
@@ -68,6 +84,11 @@ class InvitationFormFields extends StatelessWidget {
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.invitationRoleLabel,
|
||||
prefixIcon: const Icon(Icons.security_outlined),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: canCreateRoles ? onCreateRole : null,
|
||||
icon: const Icon(Icons.add_circle_outline),
|
||||
tooltip: loc.invitationAddRoleButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user