カテゴリー・パッケージ・リポジトリを検索

bottom_sheet_scaffold のカバー
パッケージ詳細v0.1.9

bottom_sheet_scaffold

Scaffoldのボディをスワイプして、下部シートをスワイプしてください。非常にシンプルでカスタマイズ可能な下部シートの実装です。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
214
いいね数
41
Pub ポイント
140

パッケージをインストール

flutter pub add bottom_sheet_scaffold

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

BottomSheetScaffold は、Scaffold のボディをスワイプすることで下部シートを開くことができる、シンプルでカスタマイズ可能な Flutter パッケージです。直感的なジェスチャーによる追加コンテンツやコントロールへのアクセスを可能にし、ユーザーインタラクションを向上させます。軽量で簡単に統合でき、Android、iOS、Web、macOS、Windows、Linux を含むすべての主要プラットフォームをサポートしています。モーダル、フィルター、またはクイックアクションに最適で、複雑なセットアップなしにスムーズなアニメーションと柔軟なカスタマイズオプションを提供します。

用途

  • ジェスチャー駆動型ボトムシートナビゲーション
  • クイックアクションパネル
  • フィルタまたは設定のオーバーレイ
  • モーダルコンテンツの表示
  • カスタマイズ可能なスライド動作

主な機能

  • Scaffold のボディからスワイプで開く
  • クロスプラットフォーム対応
  • 高度カスタマイズ可能なデザイン
  • スムーズなアニメーション遷移
  • 最小限のボイラープレートコード
  • 既存のスケルトンへの簡単な統合

適している対象

  • 簡単なボトムシートジェスチャーを探している開発者
  • 直感的な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 件

ソースリポジトリ

このパッケージを使用しているプロジェクト