Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent status bar in flutter

Tags:

flutter

I just started using flutter and android studio and I was wondering if there’s a way to make a transparent status bar like the pic on Android (no transition from the status bar to the appBar). When I try to set the status bar color, it gets a different shade than the appBar. Thanks

like image 334
Valeh Avatar asked Mar 17 '19 20:03

Valeh


People also ask

How do I make the status bar transparent Flutter?

To make the Status Bar background color transparent, Insert it into the widget builder. SystemChrome. setSystemUIOverlayStyle( SystemUiOverlayStyle( statusBarColor: Colors. transparent, //color set to transperent or set your own color statusBarIconBrightness: Brightness.

How do I change the color of my status bar Flutter?

Step 1: Locate the MaterialApp widget. Step 2: Inside the MaterialApp, add the theme parameter with ThemeData class assigned. Step 3: Inside the ThemeData add the appBarTheme parameter and then assign the AppBarTheme class. Step 4: Inside the AppBarTheme , specify the systemOverlayStyle parameter and set the color.


1 Answers

You can use the AnnotatedRegion widget with SystemUiOverlayStyle to change the chrome styles.

import 'package:flutter/services.dart';  class MyApp extends StatelessWidget {   @override   Widget build(BuildContext context) {     return AnnotatedRegion<SystemUiOverlayStyle>(       value: SystemUiOverlayStyle(         statusBarColor: Colors.transparent,       ),       child: Scaffold(...),     );   } } 

You can read more about what's possible with SystemUiOverlayStyle here.

like image 180
Sander Dalby Larsen Avatar answered Oct 10 '22 01:10

Sander Dalby Larsen