0

Why from the code bellow Android displays grey background around status bar and iOS white? And how they can be made identical?

main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Container(
          margin: EdgeInsets.only(top: 84),
          child: Text(
            'Create New',
            style: TextStyle(fontSize: 48),
          ),
        ),
      ),
    );
  }
}

Grey background on Android:

Grey background on Android

pawello2222
  • 46,897
  • 22
  • 145
  • 209
Simeon
  • 3,347
  • 1
  • 12
  • 15

1 Answers1

0

use this:

import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    FlutterStatusbarcolor.setStatusBarColor(Colors.white);
    return MaterialApp(
      title: app_title,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(title: home_title),
    );
  }
}

or this solution:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
  statusBarColor: Colors.white
));
Mansi Bhatt
  • 214
  • 3
  • 12
  • Thanks to you I found this answer - https://stackoverflow.com/questions/52489458/how-to-change-status-bar-color-in-flutter where is described how to overcome another problem with status bar text that is not visible - https://stackoverflow.com/a/58132007/6311447 – Simeon Jan 02 '21 at 11:58