Browse Source

Ensure that the controller is disposed only if initialized

Vishnu Mohandas 5 năm trước cách đây
mục cha
commit
4a90dde9a3
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  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
   void dispose() {
     _videoPlayerController.dispose();
-    _chewieController.dispose();
+    if (_chewieController != null) {
+      _chewieController.dispose();
+    }
     super.dispose();
   }
 
@@ -66,6 +68,10 @@ class _VideoWidgetState extends State<VideoWidget> {
   Widget _getLoadingWidget() {
     return Stack(children: [
       _getThumbnail(),
+      Container(
+        color: Colors.black12,
+        constraints: BoxConstraints.expand(),
+      ),
       loadWidget,
     ]);
   }