How to change status and navigation bar color in Flutter?
Date : March 29 2020, 07:55 AM
like below fixes the issue I tried the method SystemChrome.setSystemUIOverlayStyle(), as far as I tested (Flutter SDK v1.9.1+hotfix.2, running on iOS 12.1) it works perfect for Android. But for iOS, e.g. if your first screen FirstScreen() doesn't have an AppBar, but the second SecondScreen() does, then at launch the method does set the color in FirstScreen(). However, after navigating back to FirstScreen() from SecondScreen(), the status bar color becomes transparent. I come up with a hacky workaround by setting an AppBar() with zero height, then status bar's color gets changed by the AppBar, but the AppBar itself is not visible. Hope it would be useful to someone. // FirstScreen that doesn't need an AppBar
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(0),
child: AppBar( // Here we create one to set status bar color
backgroundColor: Colors.black, // Set any color of status bar you want; or it defaults to your theme's primary color
)
)
);
}
// SecondScreen that does have an AppBar
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar()
}
}
|
How to change status bar color in Flutter?
Tag : dart , By : Santhanam
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I am trying to change the status bar color to white. I found this pub on flutter. I tried to use the example code on my dart files. , Works totally fine in my app 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),
);
}
}
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white
));
|
Status bar color doesn't change in flutter
Date : March 29 2020, 07:55 AM
should help you out To set status bar color you should write code in 'build' method, as below example - @override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Color.fromRGBO(41, 167, 77, 50),
//or set color with: Color(0xFF0000FF)
statusBarIconBrightness: Brightness.dark));
return Scaffold();
}
|
How to change the Status Bar color in Flutter when we are using an AppBar?
Tag : flutter , By : Sergio Rudenko
Date : January 06 2021, 03:27 AM
I hope this helps . I want to define a specific color myself and not let the AppBar do it automatically? SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.yellow.shade600,
statusBarBrightness: Brightness.light,
statusBarIconBrightness: Brightness.dark,
));
|
Flutter: Change status bar color in iOS
Date : March 29 2020, 07:55 AM
it fixes the issue I want to change status bar color with package:flutter/services.dart package but it doesn't work. I am using Mac and iOS simulator: , Edit: appBar: AppBar(
elevation: 0,
brightness: Brightness.light, // this makes status bar text color black
backgroundColor: Colors.white,
)
AppBar(backgroundColor: Colors.red) // this changes both AppBar and status bar color in iOS
|