fix: attachment borders

This commit is contained in:
Deven Joshi
2021-05-18 15:22:41 +05:30
parent 5155940ddd
commit 9e9cd2b66f
5 changed files with 23 additions and 28 deletions
@@ -192,7 +192,7 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
attachmentBorderRadiusGeometry: widget attachmentBorderRadiusGeometry: widget
.attachmentBorderRadiusGeometry .attachmentBorderRadiusGeometry
?.mirrorBorderIfReversed( ?.mirrorBorderIfReversed(
reverse: widget.reverse), reverse: !widget.reverse),
message: widget.message.copyWith( message: widget.message.copyWith(
text: widget.message.text!.length > 200 text: widget.message.text!.length > 200
// ignore: lines_longer_than_80_chars // ignore: lines_longer_than_80_chars
@@ -980,14 +980,23 @@ class _MessageListViewState extends State<MessageListView> {
onReplyTap: widget.onReplyTap, onReplyTap: widget.onReplyTap,
attachmentBorderRadiusGeometry: BorderRadius.only( attachmentBorderRadiusGeometry: BorderRadius.only(
topLeft: Radius.circular(attachmentBorderRadius), topLeft: Radius.circular(attachmentBorderRadius),
bottomLeft: Radius.circular( bottomLeft: isMyMessage
(timeDiff >= 1 || !isNextUserSame) && ? Radius.circular(attachmentBorderRadius)
!(hasReplies || isThreadMessage || hasFileAttachment) : Radius.circular(
? 0 (timeDiff >= 1 || !isNextUserSame) &&
: attachmentBorderRadius, !(hasReplies || isThreadMessage || hasFileAttachment)
), ? 0
: attachmentBorderRadius,
),
topRight: Radius.circular(attachmentBorderRadius), topRight: Radius.circular(attachmentBorderRadius),
bottomRight: Radius.circular(attachmentBorderRadius), bottomRight: isMyMessage
? Radius.circular(
(timeDiff >= 1 || !isNextUserSame) &&
!(hasReplies || isThreadMessage || hasFileAttachment)
? 0
: attachmentBorderRadius,
)
: Radius.circular(attachmentBorderRadius),
), ),
attachmentPadding: EdgeInsets.all(hasFileAttachment ? 4 : 2), attachmentPadding: EdgeInsets.all(hasFileAttachment ? 4 : 2),
borderRadiusGeometry: BorderRadius.only( borderRadiusGeometry: BorderRadius.only(
@@ -146,7 +146,7 @@ class MessageReactionsModal extends StatelessWidget {
attachmentBorderRadiusGeometry: attachmentBorderRadiusGeometry:
attachmentBorderRadiusGeometry attachmentBorderRadiusGeometry
?.mirrorBorderIfReversed( ?.mirrorBorderIfReversed(
reverse: reverse), reverse: !reverse),
attachmentPadding: EdgeInsets.all( attachmentPadding: EdgeInsets.all(
hasFileAttachment ? 4 : 2, hasFileAttachment ? 4 : 2,
), ),
@@ -131,8 +131,6 @@ class MessageWidget extends StatefulWidget {
), ),
border, border,
reverse, reverse,
attachmentBorderRadiusGeometry as BorderRadius? ??
BorderRadius.zero,
), ),
); );
} }
@@ -157,8 +155,6 @@ class MessageWidget extends StatefulWidget {
), ),
border, border,
reverse, reverse,
attachmentBorderRadiusGeometry as BorderRadius? ??
BorderRadius.zero,
); );
}, },
'video': (context, message, attachments) { 'video': (context, message, attachments) {
@@ -191,8 +187,6 @@ class MessageWidget extends StatefulWidget {
), ),
border, border,
reverse, reverse,
attachmentBorderRadiusGeometry as BorderRadius? ??
BorderRadius.zero,
); );
}, },
'giphy': (context, message, attachments) { 'giphy': (context, message, attachments) {
@@ -219,8 +213,6 @@ class MessageWidget extends StatefulWidget {
), ),
border, border,
reverse, reverse,
attachmentBorderRadiusGeometry as BorderRadius? ??
BorderRadius.zero,
); );
}, },
'file': (context, message, attachments) { 'file': (context, message, attachments) {
@@ -248,8 +240,6 @@ class MessageWidget extends StatefulWidget {
), ),
border, border,
reverse, reverse,
attachmentBorderRadiusGeometry as BorderRadius? ??
BorderRadius.zero,
); );
}) })
.insertBetween(SizedBox( .insertBetween(SizedBox(
@@ -331,14 +331,10 @@ Widget wrapAttachmentWidget(
ShapeBorder attachmentShape, ShapeBorder attachmentShape,
// ignore: avoid_positional_boolean_parameters // ignore: avoid_positional_boolean_parameters
bool reverse, bool reverse,
BorderRadius borderRadius,
) => ) =>
ClipRRect( Material(
borderRadius: borderRadius.mirrorBorderIfReversed(reverse: reverse), clipBehavior: Clip.antiAlias,
child: Material( shape: attachmentShape,
clipBehavior: Clip.antiAlias, type: MaterialType.transparency,
shape: attachmentShape, child: attachmentWidget,
type: MaterialType.transparency,
child: attachmentWidget,
),
); );