improved Key variable structure

This commit is contained in:
Adam Velebil 2022-10-03 15:39:57 +02:00
parent 09f2199a28
commit ae8af99a39
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084
2 changed files with 8 additions and 10 deletions

View File

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:yubico_authenticator/management/views/keys.dart';
import '../../about_page.dart';
import '../../android/views/android_settings_page.dart';
@ -100,10 +99,7 @@ class MainPageDrawer extends ConsumerWidget {
if (shouldPop) Navigator.of(context).pop();
showBlurDialog(
context: context,
builder: (context) => ManagementScreen(
data,
key: screenKey,
),
builder: (context) => ManagementScreen(data),
);
},
),

View File

@ -11,7 +11,7 @@ import '../../widgets/custom_icons.dart';
import '../../widgets/responsive_dialog.dart';
import '../models.dart';
import '../state.dart';
import 'keys.dart';
import 'keys.dart' as management_keys;
final _mapEquals = const DeepCollectionEquality().equals;
@ -34,8 +34,8 @@ class _CapabilityForm extends StatelessWidget {
@override
Widget build(BuildContext context) {
final keyPrefix = (type == _CapabilityType.usb)
? usbCapabilityKeyPrefix
: nfcCapabilityKeyPrefix;
? management_keys.usbCapabilityKeyPrefix
: management_keys.nfcCapabilityKeyPrefix;
return Wrap(
spacing: 8,
runSpacing: 16,
@ -141,7 +141,9 @@ class _CapabilitiesForm extends StatelessWidget {
class ManagementScreen extends ConsumerStatefulWidget {
final YubiKeyData deviceData;
const ManagementScreen(this.deviceData, {super.key});
const ManagementScreen(this.deviceData)
: super(key: management_keys.screenKey);
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
@ -298,7 +300,7 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
actions: [
TextButton(
onPressed: canSave ? _submitForm : null,
key: saveButtonKey,
key: management_keys.saveButtonKey,
child: Text(AppLocalizations.of(context)!.mgmt_save),
),
],