open method

  1. @override
Future<Object> open(
  1. BuildContext context,
  2. VideoController controller
)
override

您需要返回一个异步事件(通常是等待页面结束的异步事件) 请参考VideoController.customFullScreen的example

You need to return an asynchronous event (usually an asynchronous event waiting for the page to end) please refer to the example of VideoController.customFullScreen

Implementation

@override
Future<Object> open(BuildContext context, VideoController controller) async {
  bool isClose = false;
  late StreamSubscription f;
  document.documentElement!.requestFullscreen();
  f = document.documentElement!.onFullscreenChange.listen((e) {
    if (document.fullscreenElement == null && !isClose) {
      this.close(context, controller);
      f.cancel();
    }
  });

  await Navigator.of(context).push(_route(controller));
  if (document.fullscreenElement != null) {
    isClose = true;
    f.cancel();
    document.exitFullscreen();
  }
  return Null;
}