How to get information such as device screen size, status bar height and so on in flutter?

How to get information such as device screen size, status bar height and so on in

flutter?

because UI is highly customized and material style is not suitable, you need to build your own navigation bar (or title bar). The height of the status bar is unknown, and the content is at the top of the screen. How to deal with it? there is no suitable library on Pub ~

.

although the open source library device_info can obtain some device information, it does not seem to include information such as screen size, status bar height, and so on.

-
material is just too little known to use ~

< hr >

is actually very simple:

// 
   double _statusBarHeight = MediaQuery.of(context).padding.top;
//MediaQuery.of(context)

// appbar 
   double _kLeadingWidth = kToolbarHeight;
Mar.25,2021

MediaQuery.of (context). Size can get the screen size, and https://github.com/jzoom/flut. can get the system bar height


Import import dart:ui;
you can do this directly:
window.devicePixelRatio gets the device pixel ratio;
window.physicalSize gets the screen size;
and other .

Import import 'dart:io';

you can view platform information

via platform library .
Menu