패키지, 저장소 및 앱 카테고리 검색

status_bar_control 표지
패키지 상세v4.0.0

status_bar_control

상태 표시줄 제어는 iOS 및 Android에서 상태 표시줄의 색상, 스타일(테마), 가시성 및 투명성 속성을 제어할 수 있게 해줍니다.

AndroidiOS
30일 다운로드
700
좋아요
91
Pub 점수
140

패키지 설치

flutter pub add status_bar_control

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

상태바 제어는 Android 및 iOS 플랫폼에서 상태바를 사용자 정의할 수 있도록 해주는 Flutter 패키지입니다. 상태바의 색상, 외관(라이트 또는 다크 테마), 가시성 및 투명도를 제어할 수 있습니다. 이 패키지는 상태바 속성을 관리하기 위한 간단하고 일관된 API를 제공하여 사용자 인터페이스 경험을 더욱 매끄럽게 합니다. 네이티브 플랫폼 기능과 원활하게 작동하며 두 가지 모바일 운영 체제 모두를 지원합니다. 컨텍스트나 테마 변경에 따라 상태바를 동적으로 조정해야 하는 앱에 적합합니다.

사용 사례

  • 화면별로 상태 표시줄 색상 맞춤 설정
  • 다크/라이트 테마용 상태 표시줄 스타일 조정
  • 임시로 상태 표시줄 숨기기
  • 상태 표시줄 투명하게 만들기
  • 전체 화면 앱에서 상태 표시줄 관리

주요 기능

  • 다중 플랫폼 지원 (iOS 및 Android)
  • 색상, 스타일, 가시성 및 투명도에 대한 제어
  • 간단하고 직관적인 API
  • 네이티브 플랫폼 동작과 호환됨
  • 추가 네이티브 코드 필요 없음

적합한 대상

  • 동적 상태 표시줄 스타일이 필요한 앱
  • 몰입형 UI를 구축하는 개발자
  • 다수의 주제를 가진 프로젝트
  • 전체 화면 또는 게임처럼 생긴 인터페이스
  • 복잡한 탐색 상태를 가진 앱

고려 사항

  • 플랫폼 고유의 동작을 올바르게 처리해야 합니다
  • 에지 케이스를 처리하기 위해 추가 구성이 필요할 수 있습니다
  • 상태 표시줄 사용자 정의만 가능
  • 고급 시스템 레벨 수정에 적합하지 않습니다
  • Flutter 라이프사이클 이벤트의 올바른 사용에 따라 달라집니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Status Bar Control

Flutter_Tests

Since flutter_statusbar_manager is no longer maintained, this package is a re-publish and will be occasionally updated for continued use in existing projects.

Buy Me A Coffee      

About

Status Bar Control, lets you control the status bar color, style (theme), visibility, and translucent properties across iOS and Android. With some added bonus for Android to control the Navigation Bar.

This plugin is based on React Native's StatusBar component.

The Navigation Bar code was taken from the awesome flutter-screen-theme-plugin.

The plugin was tested with iOS 15 and Android 12 (API 31).

Last Updates
  • v3.2.0 rename to status_bar_control and re-publish to pub.dev
  • v3.1.2 add cutout-mode for Android and SafeArea to demo app
  • v3.1.1 resolve UIOverlay-deprecations and update of demo app
  • v3.1.0 support for Android V2 thanks to jWinterDay and rafaelmaeuer
  • v3.0.1 compatible with flutter web thanks to rafaelmaeuer
  • v3.0.0 support for null safety thanks to NarHakobyan
  • v2.0.0 compatible with AndroidX thanks to lorenzOliveto

See CHANGELOG for a complete list of changes.

Examples

Build the example project for iOS and Android from the example folder.

Android
Status Bar Color Status Bar Hide Navigation Bar
Demo App Android Status Bar Demo App Android Status Bar hide Demo App Android Nav Bar
iOS
Demo Iphone 8 Demo Iphone X
Demo App Iphone 8 Demo App Iphone X

Note: not all of the shown examples might still work in the latest versions of Android or iOS

Installation

status_bar_control: ^3.2.1

to your pubspec.yaml and run

flutter pub get

in your project's root directory.

Basic Usage

Create a new project with command

flutter create myapp

On iOS add the following in your Info.plist (if not already present):

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

On Android add the following in your styles.xml (cutout-mode for API >27):

<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item>

Import the plugin in lib/main.dart like this:

import 'package:status_bar_control/status_bar_control.dart';

Methods

setColor
Platforms: Android

The setColor method will set the status bar background color. On iOS the method will always return a successful Future.

Parameter Type Default Required Description
color Color none Yes The color to be set as background, can use colors with opacity.
animated bool false No Whether or not to animate the color change.
await StatusBarControl.setColor(Colors.green, animated:true);
setTranslucent
Platforms: Android

The setTranslucent method will set the status bar translucent status. On iOS the methods will always return a successful Future.

Parameter Type Default Required Description
translucent bool none Yes Whether or not the status bar will be translucent.
await StatusBarControl.setTranslucent(true);
setHidden
Platforms: Android, iOS

The setHidden will hide the status bar.

Parameter Type Default Required Description
hidden bool none Yes Whether or not to hide the status bar.
animation StatusBarAnimation StatusBarAnimation.NONE No The hiding animation to use (iOS only).
await StatusBarControl.setHidden(true, animation:StatusBarAnimation.SLIDE);
setStyle
Platforms: Android, iOS

The setStyle method will set the status bar theme.

Parameter Type Default Required Description
style StatusBarStyle none Yes The status bar theme to use for styling, can either be light, dark, default.
await StatusBarControl.setStyle(StatusBarStyle.DARK_CONTENT);
setNetworkActivityIndicatorVisible
Platforms: iOS

The setNetworkActivityIndicatorVisible method will show or hide the activity indicator, On Android the method will always return a successful Future.

Parameter Type Default Required Description
visible bool none Yes Whether or not to show the activity indicator.
await StatusBarControl.setNetworkActivityIndicatorVisible(true);
getHeight
Platforms: Android, iOS

The getHeight getter method will return the height of the status bar.

double height = await StatusBarControl.getHeight

Bonus Methods

setNavigationBarColor
Platforms: Android

The setNavigationBarColor method will set the navigation bar background color. On iOS the method will always return a successful Future.

Parameter Type Default Required Description
color Color none Yes The color to be set as background.
animated bool false No Whether or not to animate the color change.
await StatusBarControl.setNavigationBarColor(Colors.green, animated:true);
setNavigationBarStyle
Platforms: Android

The setNavigationBarStyle method will set the navigation bar theme.

Parameter Type Default Required Description
style NavigationBarStyle none Yes The navigation bar theme to use for styling, can either be light, dark, default.
await StatusBarControl.setNavigationBarStyle(NavigationBarStyle.DARK);
setFullscreen
Platforms: Android, iOS

The setFullscreen method will set the app in fullscreen mode.

Parameter Type Default Required Description
fullscreen bool none Yes Whether or not to set the app on fullscreen mode.
await StatusBarControl.setNavigationBarStyle(NavigationBarStyle.DARK);

Enums

StatusBarStyle
  • StatusBarStyle.DEFAULT
  • StatusBarStyle.LIGHT_CONTENT
  • StatusBarStyle.DARK_CONTENT
StatusBarAnimation
  • StatusBarAnimation.NONE
  • StatusBarAnimation.FADE
  • StatusBarAnimation.SLIDE
NavigationBarStyle
  • NavigationBarStyle.DEFAULT
  • NavigationBarStyle.DARK
  • NavigationBarStyle.LIGHT

Status bar

Compatibility: Android (6.0+) & iOS

On Android, it will only work with Android 6.0 (Marshmallow) and above devices.

Navigation bar

Compatibility: Android only

Android 5.0 (Lollipop) and above: color

Android 8.0 (Oreo) and above: style (dark/light)

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트