Bläddra i källkod

Ensure that the controller is disposed only if initialized

Vishnu Mohandas 5 år sedan
förälder
incheckning
4a90dde9a3
1 ändrade filer med 7 tillägg och 1 borttagningar
  1. 7 1
      lib/ui/video_widget.dart

+ 7 - 1
lib/ui/video_widget.dart

@@ -40,7 +40,9 @@ class _VideoWidgetState extends State<VideoWidget> {
   @override
   @override
   void dispose() {
   void dispose() {
     _videoPlayerController.dispose();
     _videoPlayerController.dispose();
-    _chewieController.dispose();
+    if (_chewieController != null) {
+      _chewieController.dispose();
+    }
     super.dispose();
     super.dispose();
   }
   }
 
 
@@ -66,6 +68,10 @@ class _VideoWidgetState extends State<VideoWidget> {
   Widget _getLoadingWidget() {
   Widget _getLoadingWidget() {
     return Stack(children: [
     return Stack(children: [
       _getThumbnail(),
       _getThumbnail(),
+      Container(
+        color: Colors.black12,
+        constraints: BoxConstraints.expand(),
+      ),
       loadWidget,
       loadWidget,
     ]);
     ]);
   }
   }