From f3d713cfcc1793fb0e98309a5e8c38ae79b82922 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Fri, 4 Jun 2021 17:03:53 -0700 Subject: [PATCH] Fix invitation wrapping --- lib/widgets/invitationbubble.dart | 98 +++++++++++++++---------------- 1 file changed, 47 insertions(+), 51 deletions(-) diff --git a/lib/widgets/invitationbubble.dart b/lib/widgets/invitationbubble.dart index 3e5e8d4..600dad1 100644 --- a/lib/widgets/invitationbubble.dart +++ b/lib/widgets/invitationbubble.dart @@ -63,15 +63,15 @@ class InvitationBubbleState extends State { if (fromMe) { wdgDecorations = MessageBubbleDecoration(ackd: Provider.of(context).ackd, errored: Provider.of(context).error, fromMe: fromMe, prettyDate: prettyDate); } else if (isAccepted) { - wdgDecorations = Text("Accepted!"); + wdgDecorations = Text("Accepted!" + '\u202F'); } else if (this.rejected) { - wdgDecorations = Text("Rejected."); + wdgDecorations = Text("Rejected." + '\u202F'); } else { wdgDecorations = Center( widthFactor: 1, - child: Row(children: [ - Padding(padding: EdgeInsets.all(5), child: TextButton(child: Text("Reject"), onPressed: _btnReject)), - Padding(padding: EdgeInsets.all(5), child: TextButton(child: Text("Accept"), onPressed: _btnAccept)), + child: Wrap(children: [ + Padding(padding: EdgeInsets.all(5), child: TextButton(child: Text("Reject" + '\u202F'), onPressed: _btnReject)), + Padding(padding: EdgeInsets.all(5), child: TextButton(child: Text("Accept" + '\u202F'), onPressed: _btnAccept)), ])); } @@ -95,8 +95,8 @@ class InvitationBubbleState extends State { widthFactor: 1.0, child: Padding( padding: EdgeInsets.all(9.0), - child: Row(mainAxisSize: MainAxisSize.min, children: [ - Center(widthFactor: 1, child: Padding(padding: EdgeInsets.all(4), child: Icon(CwtchIcons.send_invite, size: 32))), + child: Wrap(runAlignment: WrapAlignment.spaceEvenly, alignment: WrapAlignment.spaceEvenly, runSpacing: 1.0, crossAxisAlignment: WrapCrossAlignment.center, children: [ + Center(widthFactor: 1, child: Padding(padding: EdgeInsets.all(10.0), child: Icon(CwtchIcons.send_invite, size: 32))), Center( widthFactor: 1.0, child: Column( @@ -129,53 +129,49 @@ class InvitationBubbleState extends State { // Construct an invite chrome for the sender Widget senderInviteChrome(String chrome, String targetName, String myKey) { - return Center( - widthFactor: 1, - child: Row(children: [ - SelectableText( - chrome, - focusNode: _focus, - style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), - ), - textAlign: TextAlign.left, - textWidthBasis: TextWidthBasis.longestLine, - ), - SelectableText( - targetName + '\u202F', - key: Key(myKey), - focusNode: _focus, - style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), - ), - textAlign: TextAlign.left, - textWidthBasis: TextWidthBasis.longestLine, - ) - ])); + return Wrap(children: [ + SelectableText( + chrome + '\u202F', + style: TextStyle( + color: Provider.of(context).theme.messageFromMeTextColor(), + ), + textAlign: TextAlign.left, + maxLines: 2, + textWidthBasis: TextWidthBasis.longestLine, + ), + SelectableText( + targetName + '\u202F', + key: Key(myKey), + style: TextStyle( + color: Provider.of(context).theme.messageFromMeTextColor(), + ), + textAlign: TextAlign.left, + maxLines: 2, + textWidthBasis: TextWidthBasis.longestLine, + ) + ]); } // Construct an invite chrome Widget inviteChrome(String chrome, String targetName, String targetId, String myKey) { - return Center( - widthFactor: 1, - child: Row(children: [ - SelectableText( - chrome, - focusNode: _focus, - style: TextStyle( - color: Provider.of(context).theme.messageFromOtherTextColor(), - ), - textAlign: TextAlign.left, - textWidthBasis: TextWidthBasis.longestLine, - ), - SelectableText( - targetName, - key: Key(myKey), - focusNode: _focus, - style: TextStyle(color: Provider.of(context).theme.messageFromOtherTextColor()), - textAlign: TextAlign.left, - textWidthBasis: TextWidthBasis.longestLine, - ) - ])); + return Wrap(children: [ + SelectableText( + chrome + '\u202F', + style: TextStyle( + color: Provider.of(context).theme.messageFromOtherTextColor(), + ), + textAlign: TextAlign.left, + textWidthBasis: TextWidthBasis.longestLine, + maxLines: 2, + ), + SelectableText( + targetName + '\u202F', + key: Key(myKey), + style: TextStyle(color: Provider.of(context).theme.messageFromOtherTextColor()), + textAlign: TextAlign.left, + maxLines: 2, + textWidthBasis: TextWidthBasis.longestLine, + ) + ]); } }