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

overscroll_pop のカバー
パッケージ詳細v0.1.1

overscroll_pop

iOS の Pinterest や Instagram アプリのように、スクロールをオーバースクロールしたときにポップするための Flutter ウィジェット。

AndroidiOSWeb
30日間ダウンロード
62
いいね数
123
Pub ポイント
130

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

flutter pub add overscroll_pop

パッケージ概要

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

Flutterパッケージで、PinterestやInstagramなどのアプリで見られるインタラクティブなスクロールリフレッシュまたは戻るジェスチャーを模倣するiOSスタイルのオーバースクロールポップ動作をScrollViewsで有効にします。スクロール可能なリストの端でオーバースクロールすることでユーザーが戻るナビゲーションを可能にし、ユーザーエクスペリエンスを向上させます。Android、iOS、Webと互換性があり、複雑なセットアップなしに既存のスクロール可能なウィジェットにシームレスに統合できます。ネイティブiOSナビゲーションパターンを再現したいアプリに最適です。

用途

  • スクロールビューでiOSスタイルの戻るジェスチャーを実装する
  • ソーシャルメディアフィードにおける直感的なナビゲーションの作成
  • リストベースのインターフェースにおけるユーザーインタラクションの向上
  • モバイルアプリに自然なオーバースクロール効果を追加する
  • スワイプして戻る機能のサポート

主な機能

  • iOS風のオーバースクロールポップ動作
  • ScrollView ウィジェットとのシームレスな統合
  • クロスプラットフォーム対応(Android、iOS、Web)
  • 必要な最小構成
  • 滑らかで応答性の高いジェスチャー検出

適している対象

  • ソーシャルメディアアプリを開発する開発者
  • TeamsがiOSネイティブな動作を再現しています
  • 直感的なスクロールベースのナビゲーションを必要とするアプリ
  • モバイルプラットフォーム向けのFlutterプロジェクト
  • ユーザー体験を重視したアプリケーションで、ジェスチャーのフィードバックを最優先

注意事項

  • 他のジェスチャーデテクターと競合する可能性があります
  • 非iOSプラットフォームでは動作が一貫性に欠けるように感じられる可能性があります
  • 異なるデバイスでの慎重なテストが必要です
  • すべてのUIデザインに適しているわけではありません
  • ジェスチャーのしきい値に対するカスタマイズオプションが限られている

元の README

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

overscroll_pop

A Flutter widget for Scrollview, pop when overscroll like Instagram, Pinterest, ...

Demo Demo Demo

Getting Started

  1. Include the package to your project as dependency:
dependencies:
  	overscroll_pop: <latest version>
  1. Use the widget:

Wrap your Scaffold or top widget by OverscrollPop, every ScrollView widget (Listview, GridView, PageView, CustomScrollView, ...) which has scroll physics ClampingScrollPhysics(important) will have overscroll to pop effect.

    MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Overscroll Example'),
        ),
        body: Builder(
          builder: (c) => Center(
            child: Hero(
              tag: '${ScrollToPopOption.start}${DragToPopDirection.toRight}',
              child: ElevatedButton(
                onPressed: () => pushPage(
                  c,
                  (BuildContext context, _, __) => VerticalScrollview(
                    scrollToPopOption: ScrollToPopOption.start,
                    dragToPopDirection: DragToPopDirection.toRight,
                  ),
                ),
                child: Text('Vertical scrollview ${ScrollToPopOption.start}'),
              ),
            ),
          ),
        ),
      ),
    );

    class VerticalScrollview extends StatelessWidget {
      final ScrollToPopOption scrollToPopOption;
      final DragToPopDirection? dragToPopDirection;

      const VerticalScrollview({
        Key? key,
        this.scrollToPopOption = ScrollToPopOption.start,
        this.dragToPopDirection,
      }) : super(key: key);

      @override
      Widget build(BuildContext context) {
        return OverscrollPop(
          scrollToPopOption: scrollToPopOption,
          dragToPopDirection: dragToPopDirection,
          child: Container(
            clipBehavior: Clip.hardEdge,
            decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.0)),
            child: Scaffold(
              appBar: PreferredSize(
                preferredSize: Size.fromHeight(kToolbarHeight),
                child: Hero(
                  tag: '$scrollToPopOption${dragToPopDirection ?? ''}',
                  child: AppBar(
                    title: Text(
                      'Vertical Scrollview',
                      overflow: TextOverflow.visible,
                    ),
                  ),
                ),
              ),
              body: ListView.builder(
                physics: const ClampingScrollPhysics(),
                itemBuilder: (_, index) => Container(
                  height: 160.0,
                  margin: const EdgeInsets.symmetric(vertical: 8.0),
                  color: index % 2 == 0 ? Colors.cyanAccent : Colors.orangeAccent,
                  alignment: Alignment.center,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(scrollToPopOption.toString()),
                      if (dragToPopDirection != null)
                        Text(dragToPopDirection.toString()),
                    ],
                  ),
                ),
                itemCount: MediaQuery.of(context).size.height ~/ 160.0 + 2,
              ),
            ),
          ),
        );
      }
    }

If your Scaffold does not contain any ScrollView and want to achieve drag to pop effect, wrap your Scaffold or top widget by DragToPop instead (Example).

Quick push route config helper:

pushOverscrollRoute(
    context: context,
    child: <your scaffold/widget>,
    // scrollToPopOption: <your ScrollToPopOption>,
    // dragToPopDirection: <your DragToPopDirection>,
    // other route configs
)

pushDragToPopRoute(
    context: context,
    child: <your scaffold/widget>,
    // other route configs
)
  1. Configure scroll direction and add extra drag to pop:
    • By default, the effect only apply for overscroll at the start of ScrollView (top edge of vertical scroll, left edge of horizontal scroll)

      VStart HStart

    • To enable the end edge (or both edges) for overscroll to pop, set scrollToPopOption to ScrollToPopOption.end (or ScrollToPopOption.both)

      OverscrollPop(
        scrollToPopOption: ScrollToPopOption.end, // or ScrollToPopOption.both
        ...
      )
      

      VEnd HEnd

    • Beside overscroll, you can config the other drag direction to achieve the pop effect by passing dragToPopDirection

      OverscrollPop(
        dragToPopDirection: DragToPopDirection.toTop, //  toTop, toBottom, toLeft, toRight, horizontal and vertical
        ...
      )
      
      1. Vertical scroll: drag to left, right or horizontal (both left and right) VStartToLeft VStartToLeft

      2. Horizontal scroll: drag to top, bottom or vertical (both top and bottom) HEndToTop HEndToBottom

カテゴリー

ソースリポジトリ

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

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