rfac: Removed basic transforms and adjusted borders
This commit is contained in:
@@ -31,10 +31,7 @@ class DeletedMessage extends StatelessWidget {
|
|||||||
final bool reverse;
|
final bool reverse;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Transform(
|
Widget build(BuildContext context) => Material(
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Material(
|
|
||||||
color: messageTheme.messageBackgroundColor,
|
color: messageTheme.messageBackgroundColor,
|
||||||
shape: shape ??
|
shape: shape ??
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
@@ -57,9 +54,6 @@ class DeletedMessage extends StatelessWidget {
|
|||||||
vertical: 8,
|
vertical: 8,
|
||||||
horizontal: 16,
|
horizontal: 16,
|
||||||
),
|
),
|
||||||
child: Transform(
|
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'Message deleted',
|
'Message deleted',
|
||||||
style: messageTheme.messageText?.copyWith(
|
style: messageTheme.messageText?.copyWith(
|
||||||
@@ -68,7 +62,5 @@ class DeletedMessage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1000,13 +1000,23 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
attachmentPadding: EdgeInsets.all(hasFileAttachment ? 4 : 2),
|
attachmentPadding: EdgeInsets.all(hasFileAttachment ? 4 : 2),
|
||||||
borderRadiusGeometry: BorderRadius.only(
|
borderRadiusGeometry: BorderRadius.only(
|
||||||
topLeft: const Radius.circular(16),
|
topLeft: const Radius.circular(16),
|
||||||
bottomLeft: Radius.circular(
|
bottomLeft: isMyMessage
|
||||||
(timeDiff >= 1 || !isNextUserSame) && !(hasReplies || isThreadMessage)
|
? const Radius.circular(16)
|
||||||
|
: Radius.circular(
|
||||||
|
(timeDiff >= 1 || !isNextUserSame) &&
|
||||||
|
!(hasReplies || isThreadMessage)
|
||||||
? 0
|
? 0
|
||||||
: 16,
|
: 16,
|
||||||
),
|
),
|
||||||
topRight: const Radius.circular(16),
|
topRight: const Radius.circular(16),
|
||||||
bottomRight: const Radius.circular(16),
|
bottomRight: isMyMessage
|
||||||
|
? Radius.circular(
|
||||||
|
(timeDiff >= 1 || !isNextUserSame) &&
|
||||||
|
!(hasReplies || isThreadMessage)
|
||||||
|
? 0
|
||||||
|
: 16,
|
||||||
|
)
|
||||||
|
: const Radius.circular(16),
|
||||||
),
|
),
|
||||||
textPadding: EdgeInsets.symmetric(
|
textPadding: EdgeInsets.symmetric(
|
||||||
vertical: 8,
|
vertical: 8,
|
||||||
|
|||||||
@@ -465,9 +465,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
: () => onLongPress(context),
|
: () => onLongPress(context),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: widget.padding ?? const EdgeInsets.all(8),
|
padding: widget.padding ?? const EdgeInsets.all(8),
|
||||||
child: Transform(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
|
||||||
child: FractionallySizedBox(
|
child: FractionallySizedBox(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
widthFactor: 0.78,
|
widthFactor: 0.78,
|
||||||
@@ -487,8 +484,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (widget.showUserAvatar ==
|
if (widget.showUserAvatar == DisplayWidget.show &&
|
||||||
DisplayWidget.show &&
|
|
||||||
widget.message.user != null) ...[
|
widget.message.user != null) ...[
|
||||||
_buildUserAvatar(),
|
_buildUserAvatar(),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
@@ -523,32 +519,25 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
: EdgeInsets.zero,
|
: EdgeInsets.zero,
|
||||||
child: (widget.message.isDeleted &&
|
child: (widget.message.isDeleted &&
|
||||||
!isFailedState)
|
!isFailedState)
|
||||||
? Transform(
|
? Container(
|
||||||
alignment: Alignment.center,
|
|
||||||
transform: Matrix4.rotationY(
|
|
||||||
widget.reverse ? pi : 0),
|
|
||||||
child: Container(
|
|
||||||
// ignore: lines_longer_than_80_chars
|
// ignore: lines_longer_than_80_chars
|
||||||
margin: EdgeInsets.symmetric(
|
margin: EdgeInsets.symmetric(
|
||||||
horizontal:
|
horizontal:
|
||||||
// ignore: lines_longer_than_80_chars
|
// ignore: lines_longer_than_80_chars
|
||||||
widget.showUserAvatar ==
|
widget.showUserAvatar ==
|
||||||
// ignore: lines_longer_than_80_chars
|
// ignore: lines_longer_than_80_chars
|
||||||
DisplayWidget.gone
|
DisplayWidget
|
||||||
|
.gone
|
||||||
? 0
|
? 0
|
||||||
: 4.0),
|
: 4.0),
|
||||||
child: DeletedMessage(
|
child: DeletedMessage(
|
||||||
reverse: widget.reverse,
|
|
||||||
// ignore: lines_longer_than_80_chars
|
|
||||||
borderRadiusGeometry: widget
|
borderRadiusGeometry: widget
|
||||||
.borderRadiusGeometry,
|
.borderRadiusGeometry,
|
||||||
borderSide:
|
borderSide: widget.borderSide,
|
||||||
widget.borderSide,
|
|
||||||
shape: widget.shape,
|
shape: widget.shape,
|
||||||
messageTheme:
|
messageTheme:
|
||||||
widget.messageTheme,
|
widget.messageTheme,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: Card(
|
: Card(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
@@ -559,15 +548,13 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
: 0.0) +
|
: 0.0) +
|
||||||
// ignore: lines_longer_than_80_chars
|
// ignore: lines_longer_than_80_chars
|
||||||
(widget.showUserAvatar ==
|
(widget.showUserAvatar ==
|
||||||
DisplayWidget
|
DisplayWidget.gone
|
||||||
.gone
|
|
||||||
? 0
|
? 0
|
||||||
: 4.0),
|
: 4.0),
|
||||||
),
|
),
|
||||||
shape: widget.shape ??
|
shape: widget.shape ??
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
side: widget
|
side: widget.borderSide ??
|
||||||
.borderSide ??
|
|
||||||
BorderSide(
|
BorderSide(
|
||||||
color: widget
|
color: widget
|
||||||
// ignore: lines_longer_than_80_chars
|
// ignore: lines_longer_than_80_chars
|
||||||
@@ -602,9 +589,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
Positioned(
|
Positioned(
|
||||||
right: 4,
|
right: 4,
|
||||||
top: -8,
|
top: -8,
|
||||||
child: Transform(
|
|
||||||
transform: Matrix4.rotationY(
|
|
||||||
widget.reverse ? pi : 0),
|
|
||||||
child: CustomPaint(
|
child: CustomPaint(
|
||||||
painter: ReactionBubblePainter(
|
painter: ReactionBubblePainter(
|
||||||
StreamChatTheme.of(context)
|
StreamChatTheme.of(context)
|
||||||
@@ -616,7 +600,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -647,7 +630,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,10 +654,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
|
|
||||||
Widget get _bottomRow {
|
Widget get _bottomRow {
|
||||||
if (isDeleted) {
|
if (isDeleted) {
|
||||||
return Transform(
|
return Row(
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
StreamSvgIcon.eye(
|
StreamSvgIcon.eye(
|
||||||
@@ -691,7 +670,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
.copyWith(color: StreamChatTheme.of(context).colorTheme.grey),
|
.copyWith(color: StreamChatTheme.of(context).colorTheme.grey),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,13 +753,9 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
),
|
),
|
||||||
...children.map(
|
...children.map(
|
||||||
(child) {
|
(child) {
|
||||||
Widget mappedChild = Transform(
|
Widget mappedChild = SizedBox(
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: SizedBox(
|
|
||||||
height: context.textScaleFactor * 14,
|
height: context.textScaleFactor * 14,
|
||||||
child: child,
|
child: child,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (child.key == usernameKey) {
|
if (child.key == usernameKey) {
|
||||||
mappedChild = Flexible(child: mappedChild);
|
mappedChild = Flexible(child: mappedChild);
|
||||||
@@ -1071,15 +1045,11 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildUserAvatar() => Transform(
|
Widget _buildUserAvatar() => Transform.translate(
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Transform.translate(
|
|
||||||
offset: Offset(
|
offset: Offset(
|
||||||
0,
|
0,
|
||||||
widget.translateUserAvatar
|
widget.translateUserAvatar
|
||||||
? (widget.messageTheme.avatarTheme?.constraints.maxHeight ??
|
? (widget.messageTheme.avatarTheme?.constraints.maxHeight ?? 40) /
|
||||||
40) /
|
|
||||||
2
|
2
|
||||||
: 0,
|
: 0,
|
||||||
),
|
),
|
||||||
@@ -1090,15 +1060,11 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
borderRadius: widget.messageTheme.avatarTheme!.borderRadius,
|
borderRadius: widget.messageTheme.avatarTheme!.borderRadius,
|
||||||
showOnlineStatus: false,
|
showOnlineStatus: false,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildTextBubble() {
|
Widget _buildTextBubble() {
|
||||||
if (widget.message.text!.trim().isEmpty) return const Offstage();
|
if (widget.message.text!.trim().isEmpty) return const Offstage();
|
||||||
return Transform(
|
return Column(
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
@@ -1120,7 +1086,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
),
|
),
|
||||||
if (hasUrlAttachments && !hasQuotedMessage) _buildUrlAttachment(),
|
if (hasUrlAttachments && !hasQuotedMessage) _buildUrlAttachment(),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,9 +133,6 @@ class QuotedMessageWidget extends StatelessWidget {
|
|||||||
if (_hasAttachments) _parseAttachments(context),
|
if (_hasAttachments) _parseAttachments(context),
|
||||||
if (msg.text!.isNotEmpty)
|
if (msg.text!.isNotEmpty)
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Transform(
|
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: MessageText(
|
child: MessageText(
|
||||||
message: msg,
|
message: msg,
|
||||||
messageTheme: isOnlyEmoji && _containsText
|
messageTheme: isOnlyEmoji && _containsText
|
||||||
@@ -149,7 +146,6 @@ class QuotedMessageWidget extends StatelessWidget {
|
|||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
].insertBetween(const SizedBox(width: 8));
|
].insertBetween(const SizedBox(width: 8));
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
@@ -218,15 +214,11 @@ class QuotedMessageWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
child = AbsorbPointer(child: child);
|
child = AbsorbPointer(child: child);
|
||||||
return Transform(
|
return Material(
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Material(
|
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
shape: attachment.type == 'file' ? null : _getDefaultShape(context),
|
shape: attachment.type == 'file' ? null : _getDefaultShape(context),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,17 +227,13 @@ class QuotedMessageWidget extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildUserAvatar() => Transform(
|
Widget _buildUserAvatar() => UserAvatar(
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: UserAvatar(
|
|
||||||
user: message.user!,
|
user: message.user!,
|
||||||
constraints: const BoxConstraints.tightFor(
|
constraints: const BoxConstraints.tightFor(
|
||||||
height: 24,
|
height: 24,
|
||||||
width: 24,
|
width: 24,
|
||||||
),
|
),
|
||||||
showOnlineStatus: false,
|
showOnlineStatus: false,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, QuotedMessageAttachmentThumbnailBuilder>
|
Map<String, QuotedMessageAttachmentThumbnailBuilder>
|
||||||
|
|||||||
@@ -52,10 +52,7 @@ class ReactionBubble extends StatelessWidget {
|
|||||||
final reactionIcons = StreamChatTheme.of(context).reactionIcons;
|
final reactionIcons = StreamChatTheme.of(context).reactionIcons;
|
||||||
final totalReactions = reactions.length;
|
final totalReactions = reactions.length;
|
||||||
final offset = totalReactions > 1 ? 16.0 : 2.0;
|
final offset = totalReactions > 1 ? 16.0 : 2.0;
|
||||||
return Transform(
|
return Stack(
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Stack(
|
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
Transform.translate(
|
Transform.translate(
|
||||||
@@ -113,7 +110,6 @@ class ReactionBubble extends StatelessWidget {
|
|||||||
child: _buildReactionsTail(context),
|
child: _buildReactionsTail(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,11 +162,7 @@ class ReactionBubble extends StatelessWidget {
|
|||||||
tailCirclesSpace: tailCirclesSpacing,
|
tailCirclesSpace: tailCirclesSpacing,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Transform(
|
return tail;
|
||||||
transform: Matrix4.rotationY(flipTail ? 0 : pi),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: tail,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -347,10 +347,6 @@ Widget wrapAttachmentWidget(
|
|||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
shape: attachmentShape,
|
shape: attachmentShape,
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
child: Transform(
|
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: attachmentWidget,
|
child: attachmentWidget,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user