분류, 패키지 및 저장소 검색

bottom_sheet_scaffold 표지
패키지 상세v0.1.9

bottom_sheet_scaffold

스캐폴드 본문을 드래그하여 하단 시트를 슬라이드하세요! 매우 간단하고 사용자 정의 가능한 하단 시트입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
214
좋아요
41
Pub 점수
140

패키지 설치

flutter pub add bottom_sheet_scaffold

패키지 개요

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

BottomSheetScaffold는 Scaffold 본문을 스와이프하여 하단 시트를 열 수 있도록 해주는 간단하고 사용자 정의 가능한 Flutter 패키지입니다. 직관적인 제스처 기반으로 추가 콘텐츠나 컨트롤에 접근할 수 있어 사용자 인터랙션을 향상시킵니다. 가볍고 쉽게 통합 가능하며 Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원합니다. 모달, 필터 또는 빠른 작업에 적합하며 복잡한 설정 없이 부드러운 애니메이션과 유연한 사용자 정의 옵션을 제공합니다.

사용 사례

  • 제스처 기반 하단 시트 탐색
  • 빠른 작업 패널
  • 필터 또는 설정 오버레이
  • 모달 콘텐츠 표시
  • 사용자 정의 가능한 슬라이딩 동작

주요 기능

  • 스카프홀드 본문에서 스와이프하여 열기
  • 크로스 플랫폼 지원
  • 높은 사용자 정의 디자인
  • 부드러운 애니메이션 전환
  • 최소한의 보일러플레이트 코드
  • 기존 스케폴딩과의 간편한 통합

적합한 대상

  • 간단한 바텀 시트 제스처를 찾는 개발자
  • 직관적인 UI 상호작용이 필요한 앱
  • 경량 바텀 시트 솔루션을 필요로 하는 프로젝트
  • 사용자 지정 가능한 바텀 시트를 원하는 디자이너
  • 빠른 UI 프로토타입 흐름

고려 사항

  • 기본 사용자 정의를 넘어서는 내장 스타일 옵션이 제한적입니다
  • 복잡한 상태 관리를 위해 추가 로직이 필요할 수 있습니다
  • 깊이 중첩되거나 다층적인 바텀 시트에는 적합하지 않습니다
  • 단일 콘텐츠 바텀 시트에 가장 적합
  • 스크롤 가능한 본문 내 스크롤 충돌을 신중하게 처리해야 합니다

원본 README

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

bottom_sheet_scaffold

Slide your bottom sheet by sliding the body of the scaffold!. Very simple and customizable bottom sheet implementation.

Features

  • Easy usage
  • Determine the height of the bottom sheet by sliding the body of the scaffold
  • Draggable bottom sheet body
  • Animated Opacity
  • Fully customizable
  • Listen the status of bottom sheet by using BottomSheetBuilder
  • No need to set any header to slide bottom sheet

Scaffold Swipping

Header Swipping

Gradient Opacity

Fixed height

Custom

Usage

Change your Scaffold into BottomSheetScaffold.

BottomSheetScaffold(
      draggableBody: true,
      dismissOnClick: true,
      barrierColor: Colors.black54,
      bottomSheet: DraggableBottomSheet(
        animationDuration: Duration(milliseconds: 200),
        body: BottomSheetBody(),
        header: BottomSheetHeader(),//header is not required
      ),
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: ScaffoldBody(),
    )
You can customize OnWillPop of BottomSheet
BottomSheetScaffold(
      draggableBody: true,
      dismissOnClick: true,
      onWillPop: (() async {
        if (BottomSheetPanel.isOpen) {
          BottomSheetPanel.close();
          return false;
        } else {
          return true;
        }
      }),
      barrierColor: Colors.black54,
      bottomSheet: DraggableBottomSheet(
        animationDuration: Duration(milliseconds: 200),
        body: BottomSheetBody(),
        header: BottomSheetHeader(),//header is not required
      ),
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: ScaffoldBody(),
    )

Barrier not being displayed in scaffold to be used inside

If you use Scaffold inside BottomSheetScaffold, you should wrap the body of the Scaffold with BarrierViewer. This way you can display the barrier color you defined when the bottom sheet is opened

return BottomSheetScaffold(
      bottomSheet: DraggableBottomSheet(
        animationDuration: const Duration(milliseconds: 200),
        body: Container(
            width: double.infinity,
            height: 500,
            alignment: Alignment.center,
            child: const Text(
              "Bottom Sheet",
              style: TextStyle(fontSize: 36, color: Colors.black),
            )),
        header: Container(
          height: 60,
          color: Colors.blue,
          child: const Center(
              child: Text(
            "Drag me",
            style: TextStyle(color: Colors.white),
          )),
        ),
      ),
      appBar: AppBar(
        title: const Text(
          "My AppBar",
        ),
      ),
      body: Scaffold(
        body: BarrierViewer(
          child: Center(
            child: Column(

DraggableBottomSheet

DraggableBottomSheet(
    {super.key,
    this.maxHeight = 500,
    this.minHeight = 0,
    this.header,
    this.animationDuration = const Duration(milliseconds: 200),
    this.autoSwipped = true,
    this.draggableBody = true,
    this.gradientOpacity = true,
    this.headerVisibilityOnTap = true,
    this.backgroundColor = Colors.white60,
    this.onHide,
    this.radius = 30,
    this.onShow,
    required this.body})

BottomSheetPanel

Open bottom sheet

BottomSheetPanel.open();

Close bottom sheet

BottomSheetPanel.close();

Update height of bottom sheet

BottomSheetPanel.close();

Check if bottom sheet is opened

BottomSheetPanel.isOpen;

Check if bottom sheet is expanded

BottomSheetPanel.isExpanded;

Check if bottom sheet is collapsed

BottomSheetPanel.isCollapsed;

DraggableArea

If you set the parameter "draggableBody" in DraggableBottomSheet to false, you will need the DraggableArea widget to scroll the bottom sheet.

DraggableBottomSheet(
        draggableBody: false,
        body: Column(
          children: [
            DraggableArea(
              child: Container(
                height: 80,
                width: double.infinity,
                color: Colors.blue,
                alignment: Alignment.center,
                child: const Text(
                  "Drag Me",
                  style: TextStyle(color: Colors.white),
                ),
              ),
            ),
            Container(
              height: 500,
              color: Colors.red,
              child: const Center(
                  child: Text(
                "Bottom Sheet",
                style: TextStyle(fontSize: 36, color: Colors.white),
              )),
            )
          ],
        ),
      )

BottomSheetBuilder

Use BottomSheetBuilder if you need to listen bottom sheet status to change something in your page.

BottomSheetBuilder(
        builder: (status, context) {
          return FloatingActionButton(
            onPressed: () {
              if (BottomSheetPanel.isExpanded) {
                BottomSheetPanel.close();
              } else {
                BottomSheetPanel.open();
              }
            },
            child: Icon(!status.isExpanded
                ? Icons.open_in_browser
                : Icons.close_fullscreen),
          );
        },
      )

Example

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return BottomSheetScaffold(
      bottomSheet: DraggableBottomSheet(
        body: const Center(
            child: Text(
          "Bottom Sheet",
          style: TextStyle(fontSize: 36, color: Colors.black),
        )),
        header: Container(
          height: 60,
          color: Colors.blue,
          child: const Center(
              child: Text(
            "Drag me",
            style: TextStyle(color: Colors.white),
          )),
        ),
      ),
      appBar: AppBar(
        title: const Text(
          "My AppBar",
        ),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            const SizedBox(
              height: 100,
            ),
            BottomSheetBuilder(
              builder: (status, context) {
                return MaterialButton(
                  color: Colors.blue,
                  onPressed: () {
                    if (BottomSheetPanel.isExpanded) {
                      BottomSheetPanel.close();
                    } else {
                      BottomSheetPanel.open();
                    }
                  },
                  child: Icon(!status.isExpanded
                      ? Icons.open_in_browser
                      : Icons.close_fullscreen),
                );
              },
            ),
            const Text(
              'Body of scaffold',
            ),
          ],
        ),
      ),
    );
  }
}

카테고리

의존성

의존성 목록 1 개

소스 저장소

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