Flutter has a ready-made API that allows for an immersive (transparent) status bar, but it does not work with lower Versions of Android.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
Copy the code

So I wrote a simple plugin that supports android4.4+ and included the above code in the code.

Usage

dependencies:
    statusbar_util: ^ 1.0.0
Copy the code
import 'package:statusbar_util/statusbar_util.dart';

void main() {
  StatusbarUtil.setTranslucent(); // Immersive (transparent)
  runApp(MyApp());
}
Copy the code

Hee hee