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,72 +142,67 @@ 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) {
onSecondaryTapDown: (details) { final showAvatar = constraints.maxWidth >= 315;
showMenu( final subtitle = helper.subtitle;
context: context, final circleAvatar = CircleAvatar(
position: RelativeRect.fromLTRB( foregroundColor: darkMode ? Colors.black : Colors.white,
details.globalPosition.dx, backgroundColor: _iconColor(darkMode ? 300 : 400),
details.globalPosition.dy, child: Text(
details.globalPosition.dx, (credential.issuer ?? credential.name)
0, .characters
), .first
items: _buildPopupMenu(context, helper), .toUpperCase(),
); style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w300),
}, ),
child: LayoutBuilder(builder: (context, constraints) { );
final showAvatar = constraints.maxWidth >= 315;
final subtitle = helper.subtitle; return Shortcuts(
shortcuts: {
final circleAvatar = CircleAvatar( LogicalKeySet(LogicalKeyboardKey.enter): const OpenIntent(),
foregroundColor: darkMode ? Colors.black : Colors.white, LogicalKeySet(LogicalKeyboardKey.space): const OpenIntent(),
backgroundColor: _iconColor(darkMode ? 300 : 400), },
child: Text( child: Semantics(
(credential.issuer ?? credential.name) label: _a11yCredentialLabel(
.characters credential.issuer, credential.name, helper.code?.value),
.first child: InkWell(
.toUpperCase(), focusNode: _focusNode,
style: borderRadius: BorderRadius.circular(30),
const TextStyle(fontSize: 16, fontWeight: FontWeight.w300), onSecondaryTapDown: (details) {
), showMenu(
); context: context,
position: RelativeRect.fromLTRB(
return Shortcuts( details.globalPosition.dx,
shortcuts: { details.globalPosition.dy,
LogicalKeySet(LogicalKeyboardKey.enter): const OpenIntent(), details.globalPosition.dx,
LogicalKeySet(LogicalKeyboardKey.space): const OpenIntent(), 0,
}, ),
child: Semantics( items: _buildPopupMenu(context, helper),
label: _a11yCredentialLabel( );
credential.issuer, credential.name, helper.code?.value), },
child: ListTile( onTap: () {
focusNode: _focusNode, if (isDesktop) {
shape: RoundedRectangleBorder( final now = DateTime.now().millisecondsSinceEpoch;
borderRadius: BorderRadius.circular(30), if (now - _lastTap < 500) {
), setState(() {
onTap: () { _lastTap = 0;
if (isDesktop) { });
final now = DateTime.now().millisecondsSinceEpoch; Actions.maybeInvoke(context, const CopyIntent());
if (now - _lastTap < 500) {
setState(() {
_lastTap = 0;
});
Actions.maybeInvoke(context, const CopyIntent());
} else {
_focusNode.requestFocus();
setState(() {
_lastTap = now;
});
}
} else { } else {
Actions.maybeInvoke<OpenIntent>( _focusNode.requestFocus();
context, const OpenIntent()); setState(() {
_lastTap = now;
});
} }
}, } else {
onLongPress: () { Actions.maybeInvoke<OpenIntent>(
Actions.maybeInvoke(context, const CopyIntent()); context, const OpenIntent());
}, }
},
onLongPress: () {
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()),
), ),
), ),
)); ),
}), ));
); });
}, },
); );
} }