Merge branch 'feature/new-ui' of github.com:GetStream/stream-chat-flutter into feat/messg-reply
Conflicts: lib/src/message_widget.dart
This commit is contained in:
@@ -79,57 +79,60 @@ class GiphyAttachment extends StatelessWidget {
|
||||
);
|
||||
}));
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
height: size?.height,
|
||||
width: size?.width,
|
||||
placeholder: (_, __) {
|
||||
return Container(
|
||||
width: size?.width,
|
||||
height: size?.height,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
},
|
||||
imageUrl: attachment.thumbUrl ??
|
||||
attachment.imageUrl ??
|
||||
attachment.assetUrl,
|
||||
errorWidget: (context, url, error) => AttachmentError(
|
||||
attachment: attachment,
|
||||
size: size,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
topRight: Radius.circular(8),
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
height: size?.height,
|
||||
width: size?.width,
|
||||
placeholder: (_, __) {
|
||||
return Container(
|
||||
width: size?.width,
|
||||
height: size?.height,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
},
|
||||
imageUrl: attachment.thumbUrl ??
|
||||
attachment.imageUrl ??
|
||||
attachment.assetUrl,
|
||||
errorWidget: (context, url, error) => AttachmentError(
|
||||
attachment: attachment,
|
||||
size: size,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
top: 0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomRight: Radius.circular(16.0),
|
||||
)),
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
child: Material(
|
||||
color: Colors.black.withOpacity(.5),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8.0,
|
||||
right: 8.0,
|
||||
top: 8.0,
|
||||
bottom: 4.0,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
vertical: 4.0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
StreamSvgIcon.lightning(
|
||||
color: StreamChatTheme.of(context).accentColor,
|
||||
size: 16.0,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
Text(
|
||||
'GIPHY',
|
||||
style: TextStyle(
|
||||
color: StreamChatTheme.of(context).accentColor,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 11.0,
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -220,6 +220,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
||||
widget.mediaSelectedCallBack(position);
|
||||
},
|
||||
child: FittedBox(
|
||||
fit: BoxFit.cover,
|
||||
child: Chewie(
|
||||
controller: controllerPackage.chewieController,
|
||||
),
|
||||
|
||||
+16
-12
@@ -198,9 +198,7 @@ class MessageWidget extends StatefulWidget {
|
||||
'giphy': (context, message, attachment) {
|
||||
return GiphyAttachment(
|
||||
attachment: attachment,
|
||||
messageTheme: messageTheme.copyWith(
|
||||
messageBackgroundColor: Colors.white,
|
||||
),
|
||||
messageTheme: messageTheme,
|
||||
message: message,
|
||||
size: Size(
|
||||
MediaQuery.of(context).size.width * 0.8,
|
||||
@@ -515,6 +513,10 @@ class _MessageWidgetState extends State<MessageWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
bool get isGiphy =>
|
||||
widget.message.attachments?.any((element) => element.type == 'giphy') ==
|
||||
true;
|
||||
|
||||
Widget _buildReadIndicator() {
|
||||
var padding = 0.0;
|
||||
return Stack(
|
||||
@@ -708,9 +710,8 @@ class _MessageWidgetState extends State<MessageWidget> {
|
||||
onTap: () => retryMessage(context),
|
||||
onLongPress: () => onLongPress(context),
|
||||
child: Material(
|
||||
color:
|
||||
attachment?.type == 'giphy' ? Colors.white : _getBackgroundColor(),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
color: _getBackgroundColor(),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: attachmentShape,
|
||||
child: Padding(
|
||||
padding: widget.attachmentPadding,
|
||||
@@ -861,9 +862,6 @@ class _MessageWidgetState extends State<MessageWidget> {
|
||||
}
|
||||
|
||||
Widget _buildTextBubble(BuildContext context) {
|
||||
final isOnlyEmoji =
|
||||
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
||||
|
||||
Widget child = Transform(
|
||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
||||
alignment: Alignment.center,
|
||||
@@ -907,10 +905,11 @@ class _MessageWidgetState extends State<MessageWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
Color _getBackgroundColor() {
|
||||
final isOnlyEmoji =
|
||||
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
||||
bool get isOnlyEmoji =>
|
||||
widget.message.text.characters.isNotEmpty &&
|
||||
widget.message.text.characters.every((c) => Emoji.byChar(c) != null);
|
||||
|
||||
Color _getBackgroundColor() {
|
||||
if (_hasReplyMessage) {
|
||||
return widget.messageTheme.messageBackgroundColor;
|
||||
}
|
||||
@@ -930,6 +929,11 @@ class _MessageWidgetState extends State<MessageWidget> {
|
||||
if (isOnlyEmoji) {
|
||||
return Colors.transparent;
|
||||
}
|
||||
|
||||
if (isGiphy) {
|
||||
return Colors.transparent;
|
||||
}
|
||||
|
||||
return widget.messageTheme.messageBackgroundColor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user