feat: Add the button to copy password on the new user creation screen #409

Merged
inex merged 4 commits from add_copy_passwd_to_users into master 2023-12-28 15:19:17 +02:00
1 changed files with 32 additions and 6 deletions

View File

@ -71,12 +71,38 @@ class NewUserPage extends StatelessWidget {
labelText: 'basis.password'.tr(),
suffixIcon: Padding(
padding: const EdgeInsets.only(right: 8),
child: IconButton(
icon: Icon(
BrandIcons.refresh,
color: Theme.of(context).colorScheme.secondary,
),
onPressed: context.read<UserFormCubit>().genNewPassword,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: Icon(
Icons.copy,
size: 24.0,
color: Theme.of(context).colorScheme.secondary,
),
onPressed: () {
final String currentPassword = context
.read<UserFormCubit>()
.password
.state
.value;
PlatformAdapter.setClipboard(currentPassword);
getIt<NavigationService>().showSnackBar(
'basis.copied_to_clipboard'.tr(),
behavior: SnackBarBehavior.floating,
);
},
),
IconButton(
icon: Icon(
Icons.refresh,
size: 24.0,
color: Theme.of(context).colorScheme.secondary,
),
onPressed:
context.read<UserFormCubit>().genNewPassword,
),
],
),
),
),