chewie icon indicating copy to clipboard operation
chewie copied to clipboard

How can I hide options on tap ?

Open mmshahshahani opened this issue 2 years ago • 1 comments

Hi I have created download option in chewie and I want to close option's window after tap on download . Anyone can help me ? thanks

void _createChewieController() {
    _chewieController = ChewieController(
      videoPlayerController: _videoPlayerController,
      autoPlay: true,
      additionalOptions: (context) {
        return <OptionItem>[
          OptionItem(
            onTap: () async {},
            iconData: Icons.download,
            title: 'Download',
          ),
        ];
      },
    );
  }

mmshahshahani avatar Oct 21 '23 12:10 mmshahshahani

Hi @mmshahshahani, I also faced this issue and when I used Navigator.pop(context) it always popped my entire route from the navigator and not just the modal. (using go_router). I could change the behavior by setting the option useRootNavigator: false on the ChewieController. e.g.:

ChewieController(
  videoPlayerController: videoPlayerController,
  useRootNavigator: false,
  additionalOptions: (context) {
    return [
      OptionItem(
        onTap: () {
          Navigator.pop(context);
        },
      ),
    ];
  },
);

ck86 avatar Dec 06 '23 16:12 ck86