My flutter app is going to full screen by default. How can I prevent this?
I do not have any code to enable the full-screen mode.
But still, it is going to full screen by default. It is happening in both Android and IOS.
Don't know how to resolve this.
Below is the complete code in my simple app.
Updated the code:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() async {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
initState() {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.bottom, SystemUiOverlay.top]);
super.initState();
}
@override
void dispose() {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.bottom, SystemUiOverlay.top]);
super.dispose();
}
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.bottom,SystemUiOverlay.top]);
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: darkMode ? lightTheme : lightTheme,
title: "APP SYDNEY",
initialRoute: '/',
routes: Navigate.routes,
);
}
}
class Pending extends StatelessWidget {
const Pending({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Scaffold(
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.tealAccent, Colors.white])),
child: Center(
child: Text(
'I am yet to be constructed',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.teal, fontSize: size.height * 0.017),
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
Navigator.pop(context);
},
child: const Icon(Icons.home),
tooltip: 'Home',
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
);
}
}
class Navigate {
static Map<String, Widget Function(BuildContext)> routes = {
'/': (context) => const Pending()
};
}
