FLUTTER ECOSYSTEM

sameeerkashyap/flutter_statusbarcolor

패키지가 Flutter 앱의 상태바 또는 네비게이션바 색상을 프로그래밍 방식으로 변경하는 데 도움을 줄 수 있습니다.

flutter_statusbarcolor 프로젝트 이미지
Stars
11
Forks
43
최근 푸시(UTC)
2024. 10. 13.
프로젝트 상태
활성
Sameer Kashyap GitHub avatar
GITHUB User

Sameer Kashyap ↗

Founder @ArcticProtocol | Celo India Fellow @celo-org, @devfolioco | @MLH Fellow | @Google DSC Lead | Mentor GSSoC 21

UCSCBengaluru, India공식 웹사이트 ↗
언어DartKotlinObjective-CRubySwift

기술 주제

사용 중인 의존성

의존성 목록 1 개
  • flutter{"sdk":"flutter"}

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

flutter_statusbarcolor_ns

pub package

The package now supports to android v2 embedding, thanks to vixez

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

This is a fork of the original package flutter_statusbarcolor migrated to support null-safety.

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.