Sender Invitation
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class InvitationFormActions extends StatelessWidget {
|
||||
final int expiryDays;
|
||||
final ValueChanged<int> onExpiryChanged;
|
||||
final bool canCreate;
|
||||
final bool hasRoles;
|
||||
final VoidCallback onSubmit;
|
||||
|
||||
const InvitationFormActions({
|
||||
super.key,
|
||||
required this.expiryDays,
|
||||
required this.onExpiryChanged,
|
||||
required this.canCreate,
|
||||
required this.hasRoles,
|
||||
required this.onSubmit,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
return Row(
|
||||
children: [
|
||||
Text(loc.invitationExpiresIn(expiryDays)),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
label: '$expiryDays',
|
||||
min: 1,
|
||||
max: 30,
|
||||
value: expiryDays.toDouble(),
|
||||
onChanged: (value) => onExpiryChanged(value.round()),
|
||||
),
|
||||
),
|
||||
FilledButton.icon(
|
||||
onPressed: canCreate && hasRoles ? onSubmit : null,
|
||||
icon: const Icon(Icons.send_outlined),
|
||||
label: Text(loc.invitationSendButton),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user