Aldy Yuan
Aldy Yuan

Reputation: 2055

How to Enable Status Bar In Flutter

My status bar were visible back then, but after I use package flutter_native_splash and flutter_launcher_icons It gone. enter image description here

I already try using SystemChrome inside build method or run method doesn't work

SystemChrome.setEnabledSystemUIOverlays(
    SystemUiOverlay.values);
SystemChrome.setSystemUIOverlayStyle(
    SystemUiOverlayStyle(statusBarColor: Colors.transparent));

Anyone know what happen?

My build Widget

 Widget build(BuildContext context) {
    SystemChrome.setEnabledSystemUIOverlays(
        SystemUiOverlay.values);
    SystemChrome.setSystemUIOverlayStyle(
        SystemUiOverlayStyle(statusBarColor: Colors.white));
    SystemChrome.setPreferredOrientations(
        [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
    return MultiProvider(
      providers: [
        ChangeNotifierProvider.value(
          value: SeedProvider(),
        ),
        ChangeNotifierProvider.value(
          value: SurgeryProvider(),
        ),
        ChangeNotifierProvider.value(
          value: CookingProvider(),
        ),
        ChangeNotifierProvider.value(
          value: FishingProvider(),
        ),
        ChangeNotifierProvider.value(
          value: CombiningProvider(),
        ),
        ChangeNotifierProvider.value(
          value: CrystalsProvider(),
        )
      ],
      child: MaterialApp(
          title: 'Grow Guides',
          theme: ThemeData(
            primaryColorBrightness: Brightness.light,
            primarySwatch: Colors.teal,
            appBarTheme: AppBarTheme(
                textTheme: Theme.of(context)
                    .textTheme
                    .apply(bodyColor: Colors.white, displayColor: Colors.white),
                iconTheme: IconThemeData(color: Colors.white)),
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          localizationsDelegates: [
            AppLocale.delegate,
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          supportedLocales: [
            const Locale('en'),
            const Locale('id'),
          ],
          onGenerateRoute: onGenerateRoute,
          debugShowCheckedModeBanner: false,
          home: Scaffold(
            appBar: AppBar(title: Text("Growtopia Guides")),
            body: HomePage(),
          )),
    );
  }

I'm not sure where the exact problem feel free to ask my code file

Upvotes: 3

Views: 2742

Answers (3)

Aldy Yuan
Aldy Yuan

Reputation: 2055

I figure it out what happen I'll post it here, in case somebody got the same problem like mine. The problem is after I use those packages which I describe, it changed the styles.xml under android/app/src/main/res/values some changes were made like :

<item name="android:windowFullscreen">true</item>

That what make my apps went Fullscreen and the status bar went invisible, so I changed it to false and worked just fine. It's totally my fault not checking those changes that were made by packages :D

Upvotes: 5

Raj Kateshiya
Raj Kateshiya

Reputation: 74

Try to change in pubspec.yaml with this (It will disable full screen):

flutter_native_splash:
  android_disable_fullscreen: true

Upvotes: 0

Nikunj Munjiyasara
Nikunj Munjiyasara

Reputation: 684

Try to change code as below:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
 statusBarColor: Colors.white
 ));

Upvotes: -1

Related Questions