clean up contacts

This commit is contained in:
Christien Rioux 2023-09-22 11:20:28 -04:00
parent a3c6b98fd5
commit accd79c82d

View File

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:math';
import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:awesome_extensions/awesome_extensions.dart';
import 'package:basic_utils/basic_utils.dart'; import 'package:basic_utils/basic_utils.dart';
@ -77,14 +78,19 @@ class ContactInvitationDisplayDialogState
final textTheme = theme.textTheme; final textTheme = theme.textTheme;
final signedContactInvitationBytesV = ref.watch(_generateFutureProvider); final signedContactInvitationBytesV = ref.watch(_generateFutureProvider);
final cardsize = MediaQuery.of(context).size.shortestSide - 48; final cardsize =
min<double>(MediaQuery.of(context).size.shortestSide - 48.0, 400);
return Dialog( return Dialog(
backgroundColor: Colors.white, backgroundColor: Colors.white,
child: FittedBox( child: ConstrainedBox(
fit: BoxFit.scaleDown, constraints: BoxConstraints(
minWidth: cardsize,
maxWidth: cardsize,
minHeight: cardsize,
maxHeight: cardsize),
child: signedContactInvitationBytesV.when( child: signedContactInvitationBytesV.when(
loading: () => waitingPage(context), loading: () => buildProgressIndicator(context),
data: (data) { data: (data) {
if (data == null) { if (data == null) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -92,47 +98,40 @@ class ContactInvitationDisplayDialogState
} }
return Form( return Form(
key: formKey, key: formKey,
child: Column( child: Column(children: [
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
FittedBox( FittedBox(
fit: BoxFit.scaleDown,
child: Text( child: Text(
translate( translate(
'send_invite_dialog.contact_invitation'), 'send_invite_dialog.contact_invitation'),
style: textTheme.headlineMedium! style: textTheme.headlineSmall!
.copyWith(color: Colors.black))) .copyWith(color: Colors.black)))
.paddingAll(8), .paddingAll(8),
FittedBox( FittedBox(
fit: BoxFit.scaleDown,
child: QrImageView.withQr( child: QrImageView.withQr(
size: 300, size: 300,
qr: QrCode.fromUint8List( qr: QrCode.fromUint8List(
data: data, data: data,
errorCorrectLevel: errorCorrectLevel:
QrErrorCorrectLevel.L))), QrErrorCorrectLevel.L)))
FittedBox( .expanded(),
fit: BoxFit.scaleDown, Text(widget.message,
child: Text(widget.message,
softWrap: true, softWrap: true,
style: textTheme.headlineSmall! style: textTheme.labelLarge!
.copyWith(color: Colors.black))) .copyWith(color: Colors.black))
.paddingAll(8), .paddingAll(8),
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.copy), icon: const Icon(Icons.copy),
label: Text(translate( label: Text(
'send_invite_dialog.copy_invitation')), translate('send_invite_dialog.copy_invitation')),
onPressed: () async { onPressed: () async {
showInfoToast( showInfoToast(
context, context,
translate( translate(
'send_invite_dialog.invitation_copied')); 'send_invite_dialog.invitation_copied'));
await Clipboard.setData(ClipboardData( await Clipboard.setData(ClipboardData(
text: text: makeTextInvite(widget.message, data)));
makeTextInvite(widget.message, data)));
}, },
).paddingAll(8), ).paddingAll(16),
])); ]));
}, },
error: (e, s) { error: (e, s) {