Remove avatar-less mode for OATH

This commit is contained in:
Dain Nilsson 2024-01-25 15:08:43 +01:00
parent 561abb30ed
commit 2de557324f
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -78,50 +78,44 @@ class _AccountViewState extends ConsumerState<AccountView> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final hasFeature = ref.watch(featureProvider); final hasFeature = ref.watch(featureProvider);
final helper = AccountHelper(context, ref, credential); final helper = AccountHelper(context, ref, credential);
final subtitle = helper.subtitle;
final circleAvatar = CircleAvatar(
foregroundColor: Theme.of(context).colorScheme.background,
backgroundColor: _iconColor(400),
child: Text(
(credential.issuer ?? credential.name).characters.first.toUpperCase(),
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w300),
),
);
return LayoutBuilder(builder: (context, constraints) { final openIntent = OpenIntent<OathCredential>(widget.credential);
final showAvatar = constraints.maxWidth >= 340; final buttonStyle = FilledButton.styleFrom(
final subtitle = helper.subtitle; backgroundColor: Theme.of(context).hoverColor, elevation: 0);
final circleAvatar = CircleAvatar( return AppListItem<OathCredential>(
foregroundColor: Theme.of(context).colorScheme.background, credential,
backgroundColor: _iconColor(400), selected: widget.selected,
child: Text( leading:
(credential.issuer ?? credential.name).characters.first.toUpperCase(), AccountIcon(issuer: credential.issuer, defaultWidget: circleAvatar),
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w300), title: helper.title,
), subtitle: subtitle,
); semanticTitle: _a11yCredentialLabel(
credential.issuer, credential.name, helper.code?.value),
final openIntent = OpenIntent<OathCredential>(widget.credential); trailing: helper.code != null
final buttonStyle = FilledButton.styleFrom( ? FilledButton.tonalIcon(
backgroundColor: Theme.of(context).hoverColor, elevation: 0); icon: helper.buildCodeIcon(),
return AppListItem<OathCredential>( label: helper.buildCodeLabel(),
credential, style: buttonStyle,
selected: widget.selected, onPressed: Actions.handler(context, openIntent),
leading: showAvatar )
? AccountIcon( : FilledButton.tonal(
issuer: credential.issuer, defaultWidget: circleAvatar) style: buttonStyle,
: null, onPressed: Actions.handler(context, openIntent),
title: helper.title, child: helper.buildCodeIcon()),
subtitle: subtitle, tapIntent: isDesktop && !widget.expanded ? null : openIntent,
semanticTitle: _a11yCredentialLabel( doubleTapIntent: hasFeature(features.accountsClipboard)
credential.issuer, credential.name, helper.code?.value), ? CopyIntent<OathCredential>(credential)
trailing: helper.code != null : null,
? FilledButton.tonalIcon( buildPopupActions: (_) => helper.buildActions(),
icon: helper.buildCodeIcon(), );
label: helper.buildCodeLabel(),
style: buttonStyle,
onPressed: Actions.handler(context, openIntent),
)
: FilledButton.tonal(
style: buttonStyle,
onPressed: Actions.handler(context, openIntent),
child: helper.buildCodeIcon()),
tapIntent: isDesktop && !widget.expanded ? null : openIntent,
doubleTapIntent: hasFeature(features.accountsClipboard)
? CopyIntent<OathCredential>(credential)
: null,
buildPopupActions: (_) => helper.buildActions(),
);
});
} }
} }