fluttercommunity / chewie

The video player for Flutter with a heart of gold
MIT License
1.92k stars 983 forks source link

fullScreenByDefault: true triggers fullscreen twice #647

Open J-Dark opened 2 years ago

J-Dark commented 2 years ago

fullScreenByDefault: true triggers the fullscreen again the first time you exit fullscreen. I'm using Navigator 2.0 (using Routemaster package) and maybe its related to #618. You can find a repo to reproduce the bug in this comment: https://github.com/fluttercommunity/chewie/issues/618#issuecomment-1156713212

d1y commented 2 years ago

me too, Is there a solution?

d1y commented 2 years ago

I used the following code and it seems to be solved 🤔

bool isInit = true;
chewieController.addListener(() {
        var isFullScreen = chewieController.isFullScreen;
        if (isFullScreen && isInit) {
          chewieController.exitFullScreen();
          setState(() {
            isInit = false;
          });
        }
      });