fix video loading and error
This commit is contained in:
+28
-19
@@ -1038,8 +1038,12 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
future: videoController.initialize(),
|
future: videoController.initialize(),
|
||||||
builder: (_, snapshot) {
|
builder: (_, snapshot) {
|
||||||
if (snapshot.connectionState != ConnectionState.done) {
|
if (snapshot.connectionState != ConnectionState.done) {
|
||||||
return Center(
|
return Container(
|
||||||
child: CircularProgressIndicator(),
|
height: 100,
|
||||||
|
width: 100,
|
||||||
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
ChewieController chewieController;
|
ChewieController chewieController;
|
||||||
@@ -1052,26 +1056,31 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
autoInitialize: false,
|
autoInitialize: false,
|
||||||
aspectRatio: videoController.value.aspectRatio,
|
aspectRatio: videoController.value.aspectRatio,
|
||||||
errorBuilder: (_, e) {
|
errorBuilder: (_, e) {
|
||||||
return Stack(
|
if (attachment.thumbUrl != null) {
|
||||||
children: <Widget>[
|
return Stack(
|
||||||
Container(
|
children: <Widget>[
|
||||||
decoration: BoxDecoration(
|
Container(
|
||||||
image: DecorationImage(
|
decoration: BoxDecoration(
|
||||||
fit: BoxFit.cover,
|
image: DecorationImage(
|
||||||
image: CachedNetworkImageProvider(
|
fit: BoxFit.cover,
|
||||||
attachment.thumbUrl,
|
image: CachedNetworkImageProvider(
|
||||||
|
attachment.thumbUrl,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
if (attachment.titleLink != null)
|
||||||
Material(
|
Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => _launchURL(attachment.titleLink),
|
onTap: () => _launchURL(attachment.titleLink),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _buildErrorImage(attachment);
|
||||||
});
|
});
|
||||||
_chuwieControllers[attachment.assetUrl] = chewieController;
|
_chuwieControllers[attachment.assetUrl] = chewieController;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user