This commit is contained in:
Dain Nilsson 2022-04-07 13:16:19 +02:00
commit 20ce8c0811
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
5 changed files with 20 additions and 17 deletions

View File

@ -26,7 +26,7 @@ class AboutPage extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// TODO: Store the version number elsewhere // TODO: Store the version number elsewhere
const Text('Yubico Authenticator: 6.0.0-alpha.1'), const Text('Yubico Authenticator: 6.0.0-alpha.2'),
if (isDesktop) if (isDesktop)
Text('ykman version: ${ref.watch(rpcStateProvider).version}'), Text('ykman version: ${ref.watch(rpcStateProvider).version}'),
Text('Dart version: ${Platform.version}'), Text('Dart version: ${Platform.version}'),

View File

@ -70,7 +70,7 @@ class FidoLockedPage extends ConsumerWidget {
}, },
), ),
MenuAction( MenuAction(
text: 'Delete all data', text: 'Reset FIDO',
icon: const Icon(Icons.delete_outline), icon: const Icon(Icons.delete_outline),
action: (context) { action: (context) {
showDialog( showDialog(

View File

@ -29,6 +29,14 @@ class _RenameAccountDialogState extends ConsumerState<RenameFingerprintDialog> {
_label = widget.fingerprint.name ?? ''; _label = widget.fingerprint.name ?? '';
} }
_submit() async {
final renamed = await ref
.read(fingerprintProvider(widget.devicePath).notifier)
.renameFingerprint(widget.fingerprint, _label);
Navigator.of(context).pop(renamed);
showMessage(context, 'Fingerprint renamed');
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// If current device changes, we need to pop back to the main Page. // If current device changes, we need to pop back to the main Page.
@ -36,14 +44,12 @@ class _RenameAccountDialogState extends ConsumerState<RenameFingerprintDialog> {
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
final fingerprint = widget.fingerprint;
return ResponsiveDialog( return ResponsiveDialog(
title: const Text('Rename fingerprint'), title: const Text('Rename fingerprint'),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text('Rename ${fingerprint.label}?'), Text('Rename ${widget.fingerprint.label}?'),
const Text('This will change the label of the fingerprint.'), const Text('This will change the label of the fingerprint.'),
TextFormField( TextFormField(
initialValue: _label, initialValue: _label,
@ -57,6 +63,11 @@ class _RenameAccountDialogState extends ConsumerState<RenameFingerprintDialog> {
_label = value.trim(); _label = value.trim();
}); });
}, },
onFieldSubmitted: (_) {
if (_label.isNotEmpty) {
_submit();
}
},
), ),
] ]
.map((e) => Padding( .map((e) => Padding(
@ -67,15 +78,7 @@ class _RenameAccountDialogState extends ConsumerState<RenameFingerprintDialog> {
), ),
actions: [ actions: [
TextButton( TextButton(
onPressed: _label.isNotEmpty onPressed: _label.isNotEmpty ? _submit : null,
? () async {
final renamed = await ref
.read(fingerprintProvider(widget.devicePath).notifier)
.renameFingerprint(fingerprint, _label);
Navigator.of(context).pop(renamed);
showMessage(context, 'Fingerprint renamed');
}
: null,
child: const Text('Save'), child: const Text('Save'),
), ),
], ],

View File

@ -71,10 +71,10 @@ class AccountDialog extends ConsumerWidget with AccountMixin {
children: [ children: [
Text(subtitle ?? ''), Text(subtitle ?? ''),
const SizedBox(height: 8.0), const SizedBox(height: 8.0),
Center(child: buildCodeView(ref, big: true)), Center(child: FittedBox(child: buildCodeView(ref, big: true))),
], ],
), ),
actions: _buildActions(context, ref), actions: [FittedBox(child: Row(children: _buildActions(context, ref)))],
), ),
); );
} }

View File

@ -142,7 +142,7 @@ class _UnlockedView extends ConsumerWidget {
}, },
), ),
MenuAction( MenuAction(
text: 'Delete all data', text: 'Reset OATH',
icon: const Icon(Icons.delete_outline), icon: const Icon(Icons.delete_outline),
action: (context) { action: (context) {
showDialog( showDialog(