How to enter full screen mode in Flutter web app

Viewed 3325

Is there a way of making a flutter web app enter fullscreen mode (hide addressbar, tabsbar and taskbar)? Or is there a way of programmatically pressing F11?

I've tried...

@override
void dispose() {
  SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
  super.dispose();
}

@override
initState() {
  SystemChrome.setEnabledSystemUIOverlays([]);
  super.initState();
}

but it didn't work in the web app (I wasn't expecting it to)

2 Answers

You might try this:

import 'dart:html';

void goFullScreen() {
  document.documentElement.requestFullscreen();
}

If somebody (like me) wants to exit the fullscreen and struggles to find how:

void exitFullScreen() {
 document.exitFullscreen();
}

Hope that's useful.

Related