Merge pull request #1558 from GetStream/fix/handle-url-attachment-error
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
instead of material indicator.
|
instead of material indicator.
|
||||||
- [[#1490]](https://github.com/GetStream/stream-chat-flutter/issues/1490) Fixed `editMessageInputBuilder` property not
|
- [[#1490]](https://github.com/GetStream/stream-chat-flutter/issues/1490) Fixed `editMessageInputBuilder` property not
|
||||||
used in `MessageActionsModal.editMessage` option.
|
used in `MessageActionsModal.editMessage` option.
|
||||||
|
- [[#1544]](https://github.com/GetStream/stream-chat-flutter/issues/1544) Fixed error thrown when unable to fetch
|
||||||
|
image/data in Message link preview.
|
||||||
|
|
||||||
## 6.1.0
|
## 6.1.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:shimmer/shimmer.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
/// {@template streamUrlAttachment}
|
/// {@template streamUrlAttachment}
|
||||||
@@ -64,10 +65,29 @@ class StreamUrlAttachment extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
CachedNetworkImage(
|
AspectRatio(
|
||||||
width: double.infinity,
|
// Default aspect ratio for Open Graph images.
|
||||||
imageUrl: urlAttachment.imageUrl!,
|
// https://www.kapwing.com/resources/what-is-an-og-image-make-and-format-og-images-for-your-blog-or-webpage
|
||||||
fit: BoxFit.cover,
|
aspectRatio: 1.91 / 1,
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
imageUrl: urlAttachment.imageUrl!,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
placeholder: (context, __) {
|
||||||
|
final image = Image.asset(
|
||||||
|
'images/placeholder.png',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
package: 'stream_chat_flutter',
|
||||||
|
);
|
||||||
|
final colorTheme =
|
||||||
|
StreamChatTheme.of(context).colorTheme;
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: colorTheme.disabled,
|
||||||
|
highlightColor: colorTheme.inputBg,
|
||||||
|
child: image,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
errorWidget: (_, __, ___) => const AttachmentError(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user