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

パッケージ詳細v0.4.8

swipeable_page_route

戻るにはスワイプして、美しく変形するウィジェットを堪能しましょう

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
1.4万
いいね数
320
Pub ポイント
160

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

flutter pub add swipeable_page_route

パッケージ概要

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

SwipeablePageRouteは、Flutterパッケージであり、ページ間のスワイプによる戻るナビゲーション操作を直感的に可能にし、画面間のスムーズな変形アニメーションによりユーザー体験を向上させます。標準のPageRouteを拡張しており、カスタマイズ可能なアニメーションと既存のナビゲーションフローへのシームレスな統合を提供します。流れるようなインタラクティブなナビゲーションを重視するアプリに最適で、Android、iOS、macOS、Windows、Linuxなど複数のプラットフォームをサポートしています。このパッケージは軽量であり、Flutterのルーティングシステムとスムーズに連携できるように設計されています。

用途

  • モバイルアプリでのスワイプバックナビゲーションの実装
  • アニメーション付きのトランジションで没入型のユーザー体験を構築する
  • ジェスチャー駆動のナビゲーションによるアプリのインタラクティブ性の向上
  • 複数のプラットフォーム間で一貫したナビゲーションパターンを構築する
  • 画面遷移にビジュアルの仕上げを加える

主な機能

  • スムーズなスワイプバックジェスチャー対応
  • カスタマイズ可能なトランジションアニメーション
  • クロスプラットフォーム互換性
  • 既存のルートとの簡単な統合
  • ナビゲーション中のモーフィングウィジェットの遷移

適している対象

  • ジェスチャーによるナビゲーションを求める開発者
  • ユーザー参加とUXに焦点を当てたアプリ
  • 複数のプラットフォームをターゲットにするFlutterプロジェクト
  • 洗練されたアニメーションを備えたデザイン重視のアプリケーション
  • 高度なナビゲーションのための最小限のセットアップを希望するチーム

注意事項

  • 複雑な遷移には追加のスタイリングが必要になる場合があります
  • アニメーション中に重いウィジェットを使用した場合のパフォーマンスへの影響
  • 基本的なスワイプ動作を超えるカスタマイズは限られている
  • シンプルで静的なナビゲーションフローには適していない
  • ネストされたナビゲーションのシナリオでは注意が必要です

元の README

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

🔙 Swipe to navigate back and admire beautifully morphing widgets.

swipeable_page_route demo

SwipeablePageRoute

SwipeablePageRoute is a specialized CupertinoPageRoute that allows your users to go back by swiping anywhere on the current page. Use it instead of MaterialPageRoute or CupertinoPageRoute:

Navigator.of(context).push(SwipeablePageRoute(
  builder: (BuildContext context) => MyPageContent(),
));

If your page contains horizontally scrollable content, you can limit SwipeablePageRoute to only react on drags from the start (left in LTR, right in RTL) screen edge — just like CupertinoPageRoute:

Navigator.of(context).push(SwipeablePageRoute(
  canOnlySwipeFromEdge: true,
  builder: (BuildContext context) => MyHorizontallyScrollablePageContent(),
));

You can get the SwipeablePageRoute wrapping your current page using context.getSwipeablePageRoute<T>().

To use swipeable pages with a PageTransitionsTheme, use SwipeablePageTransitionsBuilder.

⚠️ SwipeablePageTransitionsBuilder must be set for TargetPlatform.iOS. For all other platforms, you can decide whether you want to use it. This is because PageTransitionsTheme uses the builder for iOS whenever a pop gesture is in progress.

Usage with Go Router

To use swipeable pages with Flutter's Go Router, use SwipeablePage and the pageBuilder parameter in GoRoute instead of builder:

// Before, without swipeable pages:
GoRoute(
  builder: (context, state) => const MyScreen(),
  // ...
)

// After, with swipeable pages:
GoRoute(
  pageBuilder: (context, state) => SwipeablePage(
    builder: (context) => MyScreen(),
  ),
  // ...
)

MorphingAppBar & MorphingSliverAppBar

As you can see in the demo above, there's a beautiful animation happening to the app bar. That's a MorphingAppBar!

You can construct MorphingAppBar (corresponds to AppBar) and MorphingSliverAppBar (corresponds to SliverAppBar) just like the originals:

MorphingAppBar(
  backgroundColor: Colors.green,
  title: Text('My Page'),
  actions: [
    IconButton(
      key: ValueKey('play'),
      icon: Icon(Icons.play_arrow),
      onPressed: () {},
    ),
    IconButton(
      key: ValueKey('favorite'),
      icon: Icon(Icons.favorite),
      onPressed: () {},
    ),
    PopupMenuButton<void>(
      key: ValueKey('overflow'),
      itemBuilder: (context) => [
        PopupMenuItem<void>(child: Text('Overflow action 1')),
        PopupMenuItem<void>(child: Text('Overflow action 2')),
      ],
    ),
  ],
  bottom: TabBar(tabs: [
    Tab(text: 'Tab 1'),
    Tab(text: 'Tab 2'),
    Tab(text: 'Tab 3'),
  ]),
)

Both MorphingAppBars internally use Heros, so if you're not navigating directly inside a MaterialApp, you have to add a HeroController to your Navigator:

Navigator(
  observers: [HeroController()],
  onGenerateRoute: // ...
)

To animate additions, removals, and constants in your AppBars actions, we compare them using Widget.canUpdate(Widget old, Widget new). It compares Widgets based on their type and key, so it's recommended to give every action Widget a key (that you reuse across pages) for correct animations.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

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

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