I am facing an issue in Flutter, at least with the Android emulator, which is quite annoying.
I am using a screen in full screen mode, so I wanted to get rid of the bottom navigation bar.
For that, after researching and checking here in stackoverflow, I am using the following command:
SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]);
This is placed at the top of the class when the buid
method starts.
The problem is that, it actually works and the bottom bar goes away BUT...as soon as I interact with the screen it pops up from the bottom, overlaying anything....
It is especially annoying because my app has a tab widget in the bottom...so as soon as I touch the screen, the bottom bar pops up...so I cannot really touch the tabs, I touch the overlaying bottom bar.
Anyone knows about this problem or has experience it before?
Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.
Dart. void main() => runApp(HiddenTopAppBar()); Now we have to create a stateful widget or class that name is MyApp. In MyApp class return the MaterialApp and make the debugbanner to false, In home property call the widget scaffold.
set this your main class before widget build, try this
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: MyApp(),
);
}
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIOverlays([]);
return Scaffold(
appBar: AppBar(
title: Text('Sample App'),
),
body: Center(
child: Container(
child: Text('Demo Screen.'),
),
),
);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With