Floating View는 YouTube의 축소된 창과 유사한 피처를 제공하는 플러터 플러그인입니다. 위젯을 다른 콘텐츠 위에 띄울 수 있게 해주며, 안드로이드, iOS, 웹, macOS, Windows, 리눅스 등 다양한 플랫폼을 지원합니다. 개발자는 드래그 가능하고 크기 조절이 가능한 상호작용형 부유 창을 만들 수 있어, 지속적인 UI 요소가 필요한 앱에서 사용자 경험을 향상시킬 수 있습니다. 간단한 명령줄 설치를 통해 기존 플러터 프로젝트에 원활하게 통합할 수 있습니다.
사용 사례
지속적인 채팅 위젯 구현
미디어 재생을 위한 플로팅 컨트롤 생성
작은 오버레이 패널을 사용한 멀티태스킹 활성화
항상 표시되는 탐색 도구
인터랙티브 플로팅 메뉴 설계
주요 기능
드래그 및 크기 조절이 가능한 플로팅 창
크로스 플랫폼 지원 (Android, iOS, Web, macOS, Windows, Linux)
Flutter 위젯 시스템과의 간단한 통합
사용자 정의 가능한 외관 및 동작
터치 및 포인터 상호작용을 지원합니다
적합한 대상
미디어 앱을 개발하는 개발자
지속적인 UI 오버레이가 필요한 앱
다중 작업 또는 생산성 중심 애플리케이션
혁신적인 상호작용 패턴을 찾는 UI 디자이너
화면 내 화면 기능이 필요한 프로젝트
고려 사항
일부 운영 체제에서는 플랫폼별 권한이 필요할 수 있습니다
복잡한 중첩 위젯으로 인한 성능 영향
일부 플랫폼에서 원본 애니메이션 지원이 제한됨
전체 화면 레이아웃과의 잠재적인 UI 충돌
라이프사이클 이벤트를 신중하게 처리해야 합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
FloatingView Package
The FloatingView package enables you to create a floating window similar to YouTube's floating video feature. This allows the window to float on the screen and be draggable while scrolling.
Note:FloatingView will disappear when changing routes. To display it across routes, wrap your desired route screen with the FloatingView and use the same controller. The controller can be passed down in the widget tree or stored in state management solutions such as BLoC, Provider, etc. The FloatingView will be passed down across the screen using the Hero widget, which is currently the only option available.
Initialize the controller and store the widget you want to display, such as a video, screen, or text. Here is an example of using FloatingView with a Video Player or a simple screen:
Note:controller.initialize() will run the previous onDispose() method to clear the previous controller data if you initialize another FloatingView while having an active one.
Using the APIs:
You can use the passed-down controller to control the FloatingView state like this: