How to hide the Android Status Bar in a Flutter App?
You can use SystemChrome.setEnabledSystemUIOverlays([])
to hide and SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values)
to bring it back again.
However, there will be slight grey area and there is not fix for this as of right now. When status bar is hidden, app bar's height remains the same.
See the github issue: https://github.com/flutter/flutter/issues/14432
SystemChrome.setEnabledSystemUIOverlays([]) should do what you want.
You can bring it back with SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values)
.
Import it using
import 'package:flutter/services.dart';
body: MyAppBody(),
CHANGE THIS TO
body: SafeArea(child: MyAppBody()),
i: To hide status bar:
SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
ii: Use SafeArea Widget it will make sure that your app does not take status bar area.
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
child: Text('Do not take status bar area on screen!'),
),
);
}