Flutter web how to get full screen size

Viewed 731

I'm using MediaQuery.of(context).size.height to get screen size (height in this case) of my flutter web as we do in mobile, but when I shrink chrome (aka web browser), MediaQuery value is converts to shrunk screen size, what I want is fixed screen size which is equal to screen size of full screen. Can I do that ?

Thank-you

1 Answers

Just use SizedBox to force the screen size if it below minimum.

final size = MediaQuery.of(context).size;
final minWidth = 800.0;
final minHeight = 600.0;

SizedBox(
  width: size.width < minWidth ? minWidth : size.width,
  height: size.height < minHeight ? minHeight : size.height,
  child: const Card(child: Text('Hello World!')),
);
Related