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,48 +98,41 @@ class ContactInvitationDisplayDialogState
} }
return Form( return Form(
key: formKey, key: formKey,
child: Column( child: Column(children: [
mainAxisSize: MainAxisSize.min, FittedBox(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, child: Text(
children: [ translate(
FittedBox( 'send_invite_dialog.contact_invitation'),
fit: BoxFit.scaleDown, style: textTheme.headlineSmall!
child: Text( .copyWith(color: Colors.black)))
translate( .paddingAll(8),
'send_invite_dialog.contact_invitation'), FittedBox(
style: textTheme.headlineMedium!
.copyWith(color: Colors.black)))
.paddingAll(8),
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.labelLarge!
style: textTheme.headlineSmall! .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(
label: Text(translate( translate('send_invite_dialog.copy_invitation')),
'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: makeTextInvite(widget.message, data)));
text: },
makeTextInvite(widget.message, data))); ).paddingAll(16),
}, ]));
).paddingAll(8),
]));
}, },
error: (e, s) { error: (e, s) {
Navigator.of(context).pop(); Navigator.of(context).pop();