diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 43104bd6..73d080d2 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -952,8 +952,12 @@ class _MessageWidgetState extends State future: videoController.initialize(), builder: (_, snapshot) { if (snapshot.connectionState != ConnectionState.done) { - return Center( - child: CircularProgressIndicator(), + return Container( + height: 100, + width: 100, + child: Center( + child: CircularProgressIndicator(), + ), ); } ChewieController chewieController; @@ -966,26 +970,31 @@ class _MessageWidgetState extends State autoInitialize: false, aspectRatio: videoController.value.aspectRatio, errorBuilder: (_, e) { - return Stack( - children: [ - Container( - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: CachedNetworkImageProvider( - attachment.thumbUrl, + if (attachment.thumbUrl != null) { + return Stack( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.cover, + image: CachedNetworkImageProvider( + attachment.thumbUrl, + ), ), ), ), - ), - Material( - color: Colors.transparent, - child: InkWell( - onTap: () => _launchURL(attachment.titleLink), - ), - ), - ], - ); + if (attachment.titleLink != null) + Material( + color: Colors.transparent, + child: InkWell( + onTap: () => _launchURL(attachment.titleLink), + ), + ), + ], + ); + } + + return _buildErrorImage(attachment); }); _chuwieControllers[attachment.assetUrl] = chewieController; }