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

expandable_page_view のカバー
パッケージ詳細v1.3.0

expandable_page_view

現在表示されているページに合わせて高さを調整する PageView ウィジェット

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

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

flutter pub add expandable_page_view

パッケージ概要

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

expandable_page_view パッケージは、現在表示されているページのコンテンツに基づいて、Flutter の PageView の高さを動的に調整することで、PageView を強化します。これにより、各ページが異なる高さを持つことができながらも、全体的なレイアウトに影響を与えることなくスムーズで応答性のあるスクロールが可能になります。フォーム、カード、または動的リストのような可変高さのコンテンツを持つアプリに最適です。このパッケージは、Android、iOS、Web、macOS、Windows、Linux といったすべての主要プラットフォームをサポートしており、デバイス間で一貫した動作を保証します。

用途

  • 動的フォームページ
  • 可変高さのカードレイアウト
  • 応答性のあるスクロール可能コンテンツ
  • インタラクティブなオンボーディング画面
  • コンテンツが豊富なダッシュボード

主な機能

  • 高さは現在のページに合わせて調整されます
  • ページ間のスムーズな遷移
  • クロスプラットフォーム互換性
  • PageView とのシンプルな統合
  • ネストされたスクロールビューをサポート

適している対象

  • 高さが変動するページを持つアプリ
  • 応答性のあるスクロール動作を求める開発者
  • アダプティブUIレイアウトを必要とするプロジェクト
  • 動的なコンテンツを備えたモバイルおよびウェブアプリケーション
  • 柔軟なスクロール体験を望むUIデザイナー

注意事項

  • 大量のコンテンツでパフォーマンスに影響を与える可能性があります
  • スクロールの物理学を慎重に扱う必要があります
  • 固定高さのページデザインには適していません
  • 高さ調整以外のカスタマイズは限られている
  • 予測可能なページコンテンツサイズと併用するのが最適です

元の README

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

expandable_page_view

A PageView widget adjusting its height to currently displayed page. It accepts the same parameters as classic PageView.

Horizontal Vertical

Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  expandable_page_view: ^1.0.17

Import it:

import 'package:expandable_page_view/expandable_page_view.dart';

Usage Examples

Fixed Expandable Page View

In order to create a fixed page view just pass a list of widgets to children parameter:

ExpandablePageView(
  children: [
     ExamplePage(Colors.blue, "1", 100),
     ExamplePage(Colors.green, "2", 200),
     ExamplePage(Colors.red, "3", 300),
  ],
),
Dynamically built Expandable Page View

If You have multiple pages to display, and You want to build them dynamically while scrolling, use .builder constructor and pass itemCount and itemBuilder parameters:

ExpandablePageView.builder(
  itemCount: 3,
  itemBuilder: (context, index) {
    return ExamplePage(Colors.blue, index.toString(), (index + 1) * 100.0);
  },
),
Loop Mode

To create an infinitely scrolling page view, set loop: true:

ExpandablePageView(
  loop: true,
  children: [
    ExamplePage(Colors.blue, "1", 100),
    ExamplePage(Colors.green, "2", 200),
    ExamplePage(Colors.red, "3", 300),
  ],
),
Programmatic Control in Loop Mode

To programmatically navigate pages in loop mode (e.g., for auto-play carousels or custom indicators), use ExpandablePageController:

final controller = ExpandablePageController(itemCount: 3);

ExpandablePageView(
  controller: controller,
  loop: true,
  children: [
    ExamplePage(Colors.blue, "1", 100),
    ExamplePage(Colors.green, "2", 200),
    ExamplePage(Colors.red, "3", 300),
  ],
),

// Navigate programmatically
controller.jumpToPage(2);
controller.animateToPage(0, duration: Duration(milliseconds: 300), curve: Curves.ease);

// Read current page
print(controller.page);     // e.g., 1.5 (fractional during scroll)
print(controller.realPage); // e.g., 1 (rounded)

Note: ExpandablePageController uses shortest-path navigation — animating from page 0 to the last page will scroll backward (1 step) rather than forward through all pages.

Check out example project to play with ExpandablePageView.

カテゴリー

ソースリポジトリ

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