From accd79c82d2ac7d8fc587d355781078e5ac485b7 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Fri, 22 Sep 2023 11:20:28 -0400 Subject: [PATCH] clean up contacts --- .../contact_invitation_display.dart | 81 +++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/lib/components/contact_invitation_display.dart b/lib/components/contact_invitation_display.dart index 24047c6..5f32ca8 100644 --- a/lib/components/contact_invitation_display.dart +++ b/lib/components/contact_invitation_display.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:math'; import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:basic_utils/basic_utils.dart'; @@ -77,14 +78,19 @@ class ContactInvitationDisplayDialogState final textTheme = theme.textTheme; final signedContactInvitationBytesV = ref.watch(_generateFutureProvider); - final cardsize = MediaQuery.of(context).size.shortestSide - 48; + final cardsize = + min(MediaQuery.of(context).size.shortestSide - 48.0, 400); return Dialog( backgroundColor: Colors.white, - child: FittedBox( - fit: BoxFit.scaleDown, + child: ConstrainedBox( + constraints: BoxConstraints( + minWidth: cardsize, + maxWidth: cardsize, + minHeight: cardsize, + maxHeight: cardsize), child: signedContactInvitationBytesV.when( - loading: () => waitingPage(context), + loading: () => buildProgressIndicator(context), data: (data) { if (data == null) { Navigator.of(context).pop(); @@ -92,48 +98,41 @@ class ContactInvitationDisplayDialogState } return Form( key: formKey, - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - FittedBox( - fit: BoxFit.scaleDown, - child: Text( - translate( - 'send_invite_dialog.contact_invitation'), - style: textTheme.headlineMedium! - .copyWith(color: Colors.black))) - .paddingAll(8), - FittedBox( - fit: BoxFit.scaleDown, + child: Column(children: [ + FittedBox( + child: Text( + translate( + 'send_invite_dialog.contact_invitation'), + style: textTheme.headlineSmall! + .copyWith(color: Colors.black))) + .paddingAll(8), + FittedBox( child: QrImageView.withQr( size: 300, qr: QrCode.fromUint8List( data: data, errorCorrectLevel: - QrErrorCorrectLevel.L))), - FittedBox( - fit: BoxFit.scaleDown, - child: Text(widget.message, - softWrap: true, - style: textTheme.headlineSmall! - .copyWith(color: Colors.black))) - .paddingAll(8), - ElevatedButton.icon( - icon: const Icon(Icons.copy), - label: Text(translate( - 'send_invite_dialog.copy_invitation')), - onPressed: () async { - showInfoToast( - context, - translate( - 'send_invite_dialog.invitation_copied')); - await Clipboard.setData(ClipboardData( - text: - makeTextInvite(widget.message, data))); - }, - ).paddingAll(8), - ])); + QrErrorCorrectLevel.L))) + .expanded(), + Text(widget.message, + softWrap: true, + style: textTheme.labelLarge! + .copyWith(color: Colors.black)) + .paddingAll(8), + ElevatedButton.icon( + icon: const Icon(Icons.copy), + label: Text( + translate('send_invite_dialog.copy_invitation')), + onPressed: () async { + showInfoToast( + context, + translate( + 'send_invite_dialog.invitation_copied')); + await Clipboard.setData(ClipboardData( + text: makeTextInvite(widget.message, data))); + }, + ).paddingAll(16), + ])); }, error: (e, s) { Navigator.of(context).pop();