Pārlūkot izejas kodu

Pause video controller only if it has not been unmounted

Vishnu Mohandas 5 gadi atpakaļ
vecāks
revīzija
f645e00b4e
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3 2
      lib/ui/video_widget.dart

+ 3 - 2
lib/ui/video_widget.dart

@@ -49,7 +49,6 @@ class _VideoWidgetState extends State<VideoWidget> {
           }
         });
       } else {
-        showToast("Downloading video...", toastLength: Toast.LENGTH_SHORT);
         getFileFromServer(
           widget.file,
           progressCallback: (count, total) {
@@ -102,7 +101,9 @@ class _VideoWidgetState extends State<VideoWidget> {
       key: Key(widget.file.tag()),
       onVisibilityChanged: (info) {
         if (info.visibleFraction < 1) {
-          _chewieController.pause();
+          if (mounted) {
+            _chewieController.pause();
+          }
         }
       },
       child: Hero(