onFullscreenChange property
Returns a stream broadcasting browser's fullscreen changes.
Implementation
static Stream<bool> get onFullscreenChange {
StreamController<bool>? controller;
// Event listener reacting on fullscreen mode changes.
void fullscreenListener(web.Event _) => controller!.add(isFullscreen);
controller = StreamController<bool>(
onListen: () {
web.document.addEventListener(
'webkitfullscreenchange',
fullscreenListener.toJS,
);
web.document.addEventListener(
'mozfullscreenchange',
fullscreenListener.toJS,
);
web.document.addEventListener(
'fullscreenchange',
fullscreenListener.toJS,
);
web.document.addEventListener(
'MSFullscreenChange',
fullscreenListener.toJS,
);
},
onCancel: () {
web.document.removeEventListener(
'webkitfullscreenchange',
fullscreenListener.toJS,
);
web.document.removeEventListener(
'mozfullscreenchange',
fullscreenListener.toJS,
);
web.document.removeEventListener(
'fullscreenchange',
fullscreenListener.toJS,
);
web.document.removeEventListener(
'MSFullscreenChange',
fullscreenListener.toJS,
);
},
);
return controller.stream;
}