FLUTTER ECOSYSTEM

wrbl606/floating

Flutter용 피처 인 피처 모드 관리. Android 전용.

부유하는 프로젝트 이미지
Stars
48
Forks
30
최근 푸시(UTC)
2026. 7. 26.
프로젝트 상태
활성
Marcin Wróblewski GitHub avatar
GITHUB User

Marcin Wróblewski ↗

MonterailŻory, Poland공식 웹사이트 ↗
언어DartKotlin

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 5 개
  • flutter{"sdk":"flutter"}
  • build_runner개발 의존성^2.1.8
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^5.0.0
  • mockito개발 의존성^5.1.0

원본 README

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

README 펼치기 / 접기

floating

codecov

Picture in Picture management for Flutter. Android only

Picture in picture demo

App configuration

Add android:supportsPictureInPicture="true" line to the <activity> tag in android/src/main/AndroidManifest.xml:

<manifest>
   <application>
        <activity
            android:name=".MainActivity"
            android:supportsPictureInPicture="true"
            ...

Widget

This package provides a helper PiPSwitcher widget for switching the displayed widgets according to current PiP status. Use it like so:

PiPSwitcher(
    childWhenDisabled: Scaffold(...),
    childWhenEnabled: JustVideo(), 
)

API

PiP mode in desired mode is available only in Android so iOS and web support is not planned until the platforms adds native support for such feature.

Create a Floating instance
final floating = Floating();
Check if PiP is available
final canUsePiP = await floating.isPipAvailable;

PiP may be unavailable because of system settings managed by admin or device manufacturer. Also, the device may have Android version that was released without this feature.

Check if app is in PiP mode
final currentStatus = await floating.pipStatus;

Possible statuses:

Status Description Will enable() have an effect?
disabled PiP is available to use but currently disabled. Yes
enabled PiP is enabled. The app can display content but will not receive user inputs until the user decides to bring the app to it's full size. No
automatic PiP will be enabled automatically by the OS. Yes
unavailable PiP is disabled on given device. No
Enable PiP mode

Enable PiP right away:

final statusAfterEnabling = await floating.enable(ImmediatePiP());

Enable PiP when the app gets minimized via system gesture:

final statusAfterEnabling = await floating.enable(OnLeavePiP());

To later cancel, use .cancelOnLeavePiP().

When enabled, PiP mode can be toggled off by the user via system UI.

Arguments
aspectRatio:

The default 16/9 aspect ratio can be overridden with custom Rational. Eg. to make PiP square use: .enable(aspectRatio: Rational(1, 1)) or .enable(aspectRatio: Rational.square()).

sourceRectHint:

By default, system will simply use fade animation to tween between full app and PiP. Switching animation can be smoother by using source rect hint (example animation).

Check the example project to see an example of usage.