Coder Social home page Coder Social logo

mchome / flutter_statusbarcolor Goto Github PK

View Code? Open in Web Editor NEW
204.0 5.0 74.0 154 KB

A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.

Home Page: https://pub.dev/packages/flutter_statusbarcolor

License: MIT License

Kotlin 20.14% Objective-C 17.05% Dart 50.14% Ruby 12.68%
flutter plugin statusbar navigation color android ios flutter-plugin

flutter_statusbarcolor's Introduction

flutter_statusbarcolor

pub package

A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.

Getting Started

// change the status bar color to material color [green-400]
await FlutterStatusbarcolor.setStatusBarColor(Colors.green[400]);
if (useWhiteForeground(Colors.green[400])) {
  FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
} else {
  FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
}

// change the navigation bar color to material color [orange-200]
await FlutterStatusbarcolor.setNavigationBarColor(Colors.orange[200]);
if (useWhiteForeground(Colors.orange[200]) {
  FlutterStatusbarcolor.setNavigationBarWhiteForeground(true);
} else {
  FlutterStatusbarcolor.setNavigationBarWhiteForeground(false);
}

// get statusbar color and navigationbar color
Color statusbarColor = await FlutterStatusbarcolor.getStatusBarColor();
Color navigationbarColor = await FlutterStatusbarcolor.getNavigationBarColor();

preview

Details in example/ folder.

Api level minimum requirement

  • Android

    • getStatusBarColor (5.0)
    • setStatusBarColor (5.0)
    • setStatusBarWhiteForeground (6.0)
    • getNavigationBarColor (5.0)
    • setNavigationBarColor (5.0)
    • setNavigationBarWhiteForeground (8.0)
  • iOS

    • getStatusBarColor (7+)
    • setStatusBarColor (7+)
    • setStatusBarWhiteForeground (7+)

Note that

  • If you find the foreground brightness reverted after changing the app lifecycle, please use flutter's WidgetsBindingObserver mixin.
  • If iOS build does not work, please send issues or pull requests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.