FLUTTER ECOSYSTEM

FMorschel/floating_overlay

플로팅 위젯을 드래그하고 확대/축소할 수 있는 위젯 래퍼

플로팅 오버레이 프로젝트 이미지
Stars
7
Forks
4
최근 푸시(UTC)
2026. 3. 11.
프로젝트 상태
활성
Felipe Morschel GitHub avatar
GITHUB User

Felipe Morschel ↗

Email: me@fmorschel.dev Feel free to reach out! A programmer who likes to write better code every time.

RECHRio Grande do Sul - Brazil
언어DartHTMLSwiftKotlinObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 5 개

원본 README

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

README 펼치기 / 접기

A widget wrapper that allows a floating widget be dragged and rescaled.

Features

  • Floating widget on top of the screen
  • Resizing and repositioning the floating widget
  • Constrainable space to float inside the tree (optional)
  • Limiting borders with padding
  • State managment when pushing and poping screens (needs the RouteObserver for managing push)

FloatingOverlay

Getting started

Add to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  floating_overlay: ^1.2.1

Import the package

import 'package:floating_overlay/floating_overlay.dart';

Usage

Create a FloatingOverlayController

final controller = FloatingOverlayController.absoluteSize(
  maxSize: const Size(200, 200),
  minSize: const Size(100, 100),
  start: Offset.zero,
  padding: const EdgeInsets.all(20.0),
  constrained: true,
);

or

final controller = FloatingOverlayController.relativeSize(
  maxScale: 2.0,
  minScale: 1.0,
  start: Offset.zero,
  padding: const EdgeInsets.all(20.0),
  constrained: true,
);

Insert the FloatingOverlay widget inside your widget tree and give it the controller, a child and a floatingChild.

FloatingOverlay(
  controller: controller,
  floatingChild: SizedBox.square(
    dimension: 100.0,
    child: Container(
      decoration: BoxDecoration(
        color: Theme.of(context).primaryColor,
        border: Border.all(
          color: Colors.black,
          width: 5.0,
        ),
      ),
    ),
  ),
  child: Container(),
);

Then use the controller to make the floating child show or hide.

controller.hide();
controller.isFloating;
controller.show();
controller.toggle();