Get Status Bar Height
Complete Code For Get Status Bar Height In Flutter
Main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: GetStatusBarHeight()
)
)
);
}
}
class GetStatusBarHeight extends StatelessWidget {
@override
Widget build(BuildContext context) {
double statusBarHeight = MediaQuery.of(context).padding.top;
return Text('Status Bar Height = ' + statusBarHeight.toString(),
style: TextStyle(fontSize: 25,color: Colors.white));
}
}