This commit is contained in:
Dain Nilsson 2023-05-30 09:07:51 +02:00
commit 2aeffce0a4
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -142,7 +142,32 @@ class _AccountViewState extends ConsumerState<AccountView> {
}, },
builder: (context) { builder: (context) {
final helper = AccountHelper(context, ref, credential); final helper = AccountHelper(context, ref, credential);
return GestureDetector( return LayoutBuilder(builder: (context, constraints) {
final showAvatar = constraints.maxWidth >= 315;
final subtitle = helper.subtitle;
final circleAvatar = CircleAvatar(
foregroundColor: darkMode ? Colors.black : Colors.white,
backgroundColor: _iconColor(darkMode ? 300 : 400),
child: Text(
(credential.issuer ?? credential.name)
.characters
.first
.toUpperCase(),
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w300),
),
);
return Shortcuts(
shortcuts: {
LogicalKeySet(LogicalKeyboardKey.enter): const OpenIntent(),
LogicalKeySet(LogicalKeyboardKey.space): const OpenIntent(),
},
child: Semantics(
label: _a11yCredentialLabel(
credential.issuer, credential.name, helper.code?.value),
child: InkWell(
focusNode: _focusNode,
borderRadius: BorderRadius.circular(30),
onSecondaryTapDown: (details) { onSecondaryTapDown: (details) {
showMenu( showMenu(
context: context, context: context,
@ -155,37 +180,6 @@ class _AccountViewState extends ConsumerState<AccountView> {
items: _buildPopupMenu(context, helper), items: _buildPopupMenu(context, helper),
); );
}, },
child: LayoutBuilder(builder: (context, constraints) {
final showAvatar = constraints.maxWidth >= 315;
final subtitle = helper.subtitle;
final circleAvatar = CircleAvatar(
foregroundColor: darkMode ? Colors.black : Colors.white,
backgroundColor: _iconColor(darkMode ? 300 : 400),
child: Text(
(credential.issuer ?? credential.name)
.characters
.first
.toUpperCase(),
style:
const TextStyle(fontSize: 16, fontWeight: FontWeight.w300),
),
);
return Shortcuts(
shortcuts: {
LogicalKeySet(LogicalKeyboardKey.enter): const OpenIntent(),
LogicalKeySet(LogicalKeyboardKey.space): const OpenIntent(),
},
child: Semantics(
label: _a11yCredentialLabel(
credential.issuer, credential.name, helper.code?.value),
child: ListTile(
focusNode: _focusNode,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
onTap: () { onTap: () {
if (isDesktop) { if (isDesktop) {
final now = DateTime.now().millisecondsSinceEpoch; final now = DateTime.now().millisecondsSinceEpoch;
@ -208,6 +202,7 @@ class _AccountViewState extends ConsumerState<AccountView> {
onLongPress: () { onLongPress: () {
Actions.maybeInvoke(context, const CopyIntent()); Actions.maybeInvoke(context, const CopyIntent());
}, },
child: ListTile(
leading: showAvatar leading: showAvatar
? AccountIcon( ? AccountIcon(
issuer: credential.issuer, issuer: credential.issuer,
@ -247,9 +242,9 @@ class _AccountViewState extends ConsumerState<AccountView> {
child: helper.buildCodeIcon()), child: helper.buildCodeIcon()),
), ),
), ),
),
)); ));
}), });
);
}, },
); );
} }