パッケージ、リポジトリ、アプリカテゴリを検索

sliver_app_bar_builder のカバー
パッケージ詳細v1.1.1

sliver_app_bar_builder

アプリバー用に本当にカスタマイズ可能なスリバーで、ビルダーを使用する利点があります。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
1.6万
いいね数
121
Pub ポイント
160

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

flutter pub add sliver_app_bar_builder

パッケージ概要

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

ビルダーパターンを活用して動的なコンテンツ生成を行う、高度にカスタマイズ可能なスリバー形式のアプリバーです。開発者がレイアウトや動作に対して細かく制御できるように、複雑で応答性のあるアプリバーを構築できます。スクロール可能なリスト内での使用を目的としており、スムーズな遷移をサポートし、Flutterのスリバーシステムとシームレスに統合されています。スクロール位置や状態の変化に基づいてヘッダーが適応する、没入型のスクロール体験を作成するのに最適なパッケージです。

用途

  • スクロール可能なリスト内のカスタマイズ可能なアプリバー
  • スクロール位置に基づく動的ヘッダー コンテンツ
  • スリバーズを備えた複雑なUIレイアウト
  • モバイルおよびウェブ向けのレスポンシブデザイン
  • アプリバーでパララックス効果を実装する
  • インタラクティブなナビゲーションヘッダーの構築

主な機能

  • ビルダーベースのコンテンツ作成
  • スリバー動作の完全カスタマイズ
  • すべての主要プラットフォームをサポートしています
  • ScrollView とのスムーズな統合
  • スクロール進捗に適応可能
  • 高度なUIパターンに対応する拡張可能

適している対象

  • 複雑なスクロール可能なインターフェースを構築する開発者
  • 柔軟なヘッダー コンポーネントが必要なデザイナー
  • 動的なアプリバー動作を必要とするアプリ
  • 複数のデバイスをターゲットにしたクロスプラットフォームアプリ
  • 宣言的UIパターンを使用するチーム

注意事項

  • Flutter の Sliver システムの理解が必要です
  • シンプルなアプリバーの複雑さを増す可能性があります
  • 高度なUI要件に最適
  • 基本的な静的ヘッダーには推奨されません
  • パフォーマンスはビルダー論理の効率に依存します

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

netglade

Developed with 💚 by netglade

ci pub package license: MIT style: netglade analysis Discord


A truly customizable sliver for app bars with the benefit of using builders. Check the storybook demo and play with it yourself.

SliverAppBarBuilder supports various configurations:

  • bar
    • height
    • initialHeight (when expanded)
    • background (for everything or bar only)
  • content
    • builder
    • initialHeight
    • toggle contentBelowBar (whether content is on top or below bar)
    • padding
  • leading and trailing actions
    • list of builders
    • toggle collapsing
    • padding
  • stretching
    • toggle stretch
    • stretchConfiguration
  • misc
    • pinned mode
    • toggle mode
    • toggle debug (so you can debug each part visually)

Getting Started

Using the package is simple. Just use the sliver SliverAppBarBuilder in place of SliverAppBar, configure all the properties, and enjoy.

Each builder, for content or leading/trailing actions, provides expand ratio and content/bar height, so you can easily use these values to customize your headers.

  • expandRatio is a value between 1.0 when expanded and 0.0 when shrunken
  • contentHeight/barHeight are current heights of corresponding parts

Content builder has additional property:

  • centerPadding, when contentBelowBar is false, is a value used to offset content to center it with bar

An example of a header with title moving from under back button to its right might look like this:

CustomScrollView(
  slivers: [
    SliverAppBarBuilder(
      barHeight: 60,
      pinned: true,
      leadingActions: [
        (context, expandRatio, barHeight, overlapsContent) {
          return SizedBox(
            height: barHeight,
            child: const BackButton(),
          );
        }
      ],
      initialContentHeight: 150,
      contentBuilder: (context, expandRatio, contentHeight, centerPadding, overlapsContent) {
        return Container(
          alignment: Alignment.centerLeft,
          height: 60,
          transform: Matrix4.translationValues(10 + (1 - expandRatio) * 40, 0, 0),
          child: Text(
            'My Title',
            style: TextStyle(
              fontSize: 22 + expandRatio * 10,
              color: Colors.white,
              fontWeight: FontWeight.bold,
            ),
          ),
        );
      },
    ),
  ],
);

Development

Flutter is pinned with FVM in .fvmrc (currently 3.41.5):

fvm install
fvm flutter pub get

The repository uses Melos as a task runner (the published package lives in the repository root, so the root itself is the only Melos package). Melos is configured with sdkPath: .fvm/flutter_sdk, so scripts always run against the pinned SDK:

fvm dart run melos run lint:all      # format check + flutter analyze + DCM
fvm dart run melos run lint:format   # dart format --set-exit-if-changed
fvm dart run melos run lint:dart     # flutter analyze
fvm dart run melos run lint:dcm      # dcm analyze
fvm dart run melos run format        # write formatting
fvm dart run melos run test          # flutter test

Run fvm dart run melos run --list to see all scripts. CI runs the very same commands; where FVM is not available, set MELOS_SDK_PATH=auto to run the scripts against the SDK on the PATH.

lint:dcm needs the DCM CLI on the PATH; the version used by CI is pinned in dcm_global.yaml.

カテゴリー

ソースリポジトリ

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

データはまだありません。