Apr 05, 2022
.
Admin
Hi friends,
In this post, we will learn How To get status bar height in flutter. i explained simply step by step How To Get Status Bar Height Using Flutter Android App - flutter. Here you will learn Simple Flutter: Get the Heights of Status Bar. This tutorial will give you simple example Get Status Bar Height in Flutter Android iOS App.
I will give you simple Example of How To get status bar height in flutter.
So let's see bellow example:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class GetStatusBarH extends StatelessWidget {
@override
Widget build(BuildContext context) {
double statusBarHeight = MediaQuery.of(context).padding.top;
return Text('This Status Bar Height = ' + statusBarHeight.toString(),
style: TextStyle(fontSize: 28));
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: GetStatusBarH()
)
)
);
}
}
Output
I hope it will help you....
#Flutter