mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-23 00:57:26 +03:00
Add semantics
This commit is contained in:
parent
947b9f1079
commit
1f8c9dc8fb
@ -90,61 +90,68 @@ class _OathAddMultiAccountPageState
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
secondary: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
if (isTouchSupported())
|
||||
IconButton(
|
||||
tooltip: l10n.s_require_touch,
|
||||
color: touch ? colorScheme.primary : null,
|
||||
onPressed: unique
|
||||
? () {
|
||||
setState(() {
|
||||
_credStates[cred] =
|
||||
(checked, !touch, unique);
|
||||
});
|
||||
}
|
||||
: null,
|
||||
icon: Icon(touch
|
||||
? Icons.touch_app
|
||||
: Icons.touch_app_outlined)),
|
||||
IconButton(
|
||||
tooltip: l10n.s_rename_account,
|
||||
onPressed: () async {
|
||||
final node = ref
|
||||
.read(currentDeviceDataProvider)
|
||||
.valueOrNull
|
||||
?.node;
|
||||
final withContext = ref.read(withContextProvider);
|
||||
CredentialData? renamed = await withContext(
|
||||
(context) async => await showBlurDialog(
|
||||
context: context,
|
||||
builder: (context) => RenameAccountDialog(
|
||||
device: node!,
|
||||
issuer: cred.issuer,
|
||||
name: cred.name,
|
||||
oathType: cred.oathType,
|
||||
period: cred.period,
|
||||
existing: (widget.credentialsFromUri ?? [])
|
||||
.map((e) => (e.issuer, e.name))
|
||||
.followedBy((_credentials ?? [])
|
||||
.map((e) => (e.issuer, e.name)))
|
||||
.toList(),
|
||||
rename: (issuer, name) async => cred
|
||||
.copyWith(issuer: issuer, name: name),
|
||||
),
|
||||
));
|
||||
if (renamed != null) {
|
||||
setState(() {
|
||||
int index = widget.credentialsFromUri!.indexWhere(
|
||||
(element) =>
|
||||
element.name == cred.name &&
|
||||
(element.issuer == cred.issuer));
|
||||
widget.credentialsFromUri![index] = renamed;
|
||||
_credStates.remove(cred);
|
||||
_credStates[renamed] = (true, touch, true);
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: IconTheme(
|
||||
data: IconTheme.of(context),
|
||||
child: const Icon(Icons.edit_outlined)),
|
||||
Semantics(
|
||||
label: l10n.s_require_touch,
|
||||
child: IconButton(
|
||||
tooltip: l10n.s_require_touch,
|
||||
color: touch ? colorScheme.primary : null,
|
||||
onPressed: unique
|
||||
? () {
|
||||
setState(() {
|
||||
_credStates[cred] =
|
||||
(checked, !touch, unique);
|
||||
});
|
||||
}
|
||||
: null,
|
||||
icon: Icon(touch
|
||||
? Icons.touch_app
|
||||
: Icons.touch_app_outlined)),
|
||||
),
|
||||
Semantics(
|
||||
label: l10n.s_rename_account,
|
||||
child: IconButton(
|
||||
tooltip: l10n.s_rename_account,
|
||||
onPressed: () async {
|
||||
final node = ref
|
||||
.read(currentDeviceDataProvider)
|
||||
.valueOrNull
|
||||
?.node;
|
||||
final withContext = ref.read(withContextProvider);
|
||||
CredentialData? renamed = await withContext(
|
||||
(context) async => await showBlurDialog(
|
||||
context: context,
|
||||
builder: (context) => RenameAccountDialog(
|
||||
device: node!,
|
||||
issuer: cred.issuer,
|
||||
name: cred.name,
|
||||
oathType: cred.oathType,
|
||||
period: cred.period,
|
||||
existing: (widget.credentialsFromUri ??
|
||||
[])
|
||||
.map((e) => (e.issuer, e.name))
|
||||
.followedBy((_credentials ?? [])
|
||||
.map((e) => (e.issuer, e.name)))
|
||||
.toList(),
|
||||
rename: (issuer, name) async => cred
|
||||
.copyWith(issuer: issuer, name: name),
|
||||
),
|
||||
));
|
||||
if (renamed != null) {
|
||||
setState(() {
|
||||
int index = widget.credentialsFromUri!.indexWhere(
|
||||
(element) =>
|
||||
element.name == cred.name &&
|
||||
(element.issuer == cred.issuer));
|
||||
widget.credentialsFromUri![index] = renamed;
|
||||
_credStates.remove(cred);
|
||||
_credStates[renamed] = (true, touch, true);
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: IconTheme(
|
||||
data: IconTheme.of(context),
|
||||
child: const Icon(Icons.edit_outlined)),
|
||||
),
|
||||
),
|
||||
]),
|
||||
title: Text(cred.issuer ?? cred.name,
|
||||
|
@ -97,24 +97,27 @@ class _CertificateListItem extends StatelessWidget {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return AppListItem(
|
||||
leading: CircleAvatar(
|
||||
foregroundColor: colorScheme.onSecondary,
|
||||
backgroundColor: colorScheme.secondary,
|
||||
child: const Icon(Icons.approval),
|
||||
),
|
||||
title: slot.getDisplayName(l10n),
|
||||
subtitle: certInfo != null
|
||||
// Simplify subtitle by stripping "CN=", etc.
|
||||
? certInfo.subject.replaceAll(RegExp(r'[A-Z]+='), ' ').trimLeft()
|
||||
: pivSlot.hasKey == true
|
||||
? l10n.l_key_no_certificate
|
||||
: l10n.l_no_certificate,
|
||||
trailing: OutlinedButton(
|
||||
onPressed: Actions.handler(context, const OpenIntent()),
|
||||
child: const Icon(Icons.more_horiz),
|
||||
),
|
||||
buildPopupActions: (context) => buildSlotActions(certInfo != null, l10n),
|
||||
);
|
||||
return Semantics(
|
||||
label: slot.getDisplayName(l10n),
|
||||
child: AppListItem(
|
||||
leading: CircleAvatar(
|
||||
foregroundColor: colorScheme.onSecondary,
|
||||
backgroundColor: colorScheme.secondary,
|
||||
child: const Icon(Icons.approval),
|
||||
),
|
||||
title: slot.getDisplayName(l10n),
|
||||
subtitle: certInfo != null
|
||||
// Simplify subtitle by stripping "CN=", etc.
|
||||
? certInfo.subject.replaceAll(RegExp(r'[A-Z]+='), ' ').trimLeft()
|
||||
: pivSlot.hasKey == true
|
||||
? l10n.l_key_no_certificate
|
||||
: l10n.l_no_certificate,
|
||||
trailing: OutlinedButton(
|
||||
onPressed: Actions.handler(context, const OpenIntent()),
|
||||
child: const Icon(Icons.more_horiz),
|
||||
),
|
||||
buildPopupActions: (context) =>
|
||||
buildSlotActions(certInfo != null, l10n),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user