How to get status bar height in Flutter?

Viewed 15258

How do I get the status bar height?

enter image description here

2 Answers
var height = MediaQuery.of(context).viewPadding.top;

Note: This will only work on mobile devices because other platforms don't have a dedicated status bar and it will returns 0.0 for them.

Hope it will help you, just add latest GetX package in your application and import following library in your code.

import 'package:get/get.dart';

Status Bar Height

To get status bar height use following a bit code:

Get.statusBarHeight;

Bottom Bar Height

To get bottom bar height use following a bit code:

Get.bottomBarHeight;

Screen Height

To get screen height use following a bit code:

Get.height;

Screen Width

To get screen width use following a bit code:

Get.width;

Also you can use SafeArea() widget to ignore overlays to use this just wrap your widget with this.

Related