improved fingerprint views

This commit is contained in:
Adam Velebil 2024-07-04 14:36:42 +02:00
parent 742d5d79b9
commit 6a22c23ece
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10
2 changed files with 18 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Yubico.
* Copyright (C) 2022-2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -255,7 +255,11 @@ class _AddFingerprintDialogState extends ConsumerState<AddFingerprintDialog>
});
},
onFieldSubmitted: (_) {
if (_label.isNotEmpty) {
_submit();
} else {
_nameFocus.requestFocus();
}
},
).init(),
)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Yubico.
* Copyright (C) 2022-2024 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,12 +41,20 @@ class RenameFingerprintDialog extends ConsumerStatefulWidget {
class _RenameAccountDialogState extends ConsumerState<RenameFingerprintDialog> {
late String _label;
late FocusNode _labelFocus;
_RenameAccountDialogState();
@override
void initState() {
super.initState();
_label = widget.fingerprint.name ?? '';
_labelFocus = FocusNode();
}
@override
void dispose() {
_labelFocus.dispose();
super.dispose();
}
_submit() async {
@ -94,6 +102,7 @@ class _RenameAccountDialogState extends ConsumerState<RenameFingerprintDialog> {
Text(l10n.p_will_change_label_fp),
AppTextFormField(
initialValue: _label,
focusNode: _labelFocus,
maxLength: 15,
inputFormatters: [limitBytesLength(15)],
buildCounter: buildByteCounterFor(_label),
@ -110,6 +119,8 @@ class _RenameAccountDialogState extends ConsumerState<RenameFingerprintDialog> {
onFieldSubmitted: (_) {
if (_label.isNotEmpty) {
_submit();
} else {
_labelFocus.requestFocus();
}
},
).init(),