From 6782a49b4d9874372330dc794f70ba3cdff4847e Mon Sep 17 00:00:00 2001 From: Develeste <93141030+Develeste@users.noreply.github.com> Date: Fri, 19 Nov 2021 00:02:52 +0900 Subject: [PATCH] When uploading a video, applying indicator (#469) --- lib/src/widgets/video_app.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/video_app.dart b/lib/src/widgets/video_app.dart index 44753a72..6d080f24 100644 --- a/lib/src/widgets/video_app.dart +++ b/lib/src/widgets/video_app.dart @@ -35,13 +35,15 @@ class _VideoAppState extends State { // Ensure the first frame is shown after the video is initialized, // even before the play button has been pressed. setState(() {}); - }); + }).catchError((error) { + setState(() {}); + });; } @override Widget build(BuildContext context) { final defaultStyles = DefaultStyles.getInstance(context); - if (!_controller.value.isInitialized || _controller.value.hasError) { + if (_controller.value.hasError) { if (widget.readOnly) { return RichText( text: TextSpan( @@ -54,6 +56,11 @@ class _VideoAppState extends State { return RichText( text: TextSpan(text: widget.videoUrl, style: defaultStyles.link)); + } else if (!_controller.value.isInitialized) { + return VideoProgressIndicator(_controller, + allowScrubbing: true, + colors: VideoProgressColors(playedColor: Colors.blue), + ); } return Container(