James Piner
James Piner

Reputation: 329

Flutter Dark mode statusbar color

How do you change the status bar text color to black when its in dark mode? I can't find an answer for dark mode only in flutter.

void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Fry',
      theme: ThemeData(),
      darkTheme: ThemeData(
      ),
      home: Loader(),
      routes: {
        MainMenu.id : (context) => MainMenu(),
      },
      debugShowCheckedModeBanner: false,
    );
  }
}

Upvotes: 1

Views: 482

Answers (1)

Ali Bayram
Ali Bayram

Reputation: 7931

for iOS open Info.plist, it is under ios/Runner and add that;

<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>

and import services library to your main.dart file;

import 'package:flutter/services.dart';

and use this to change the status bar color;

SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(statusBarBrightness: Brightness.light)
);

Upvotes: 3

Related Questions