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

パッケージ詳細v0.1.0+1

flutter_custom_carousel

完全にカスタム可能でアニメーション付きのスクロール可能なリストを作成するためのウィジェットです。すべての難しいスクロール処理を管理し、視覚的な表現はあなた次第です。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
11
いいね数
345
Pub ポイント
150

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

flutter pub add flutter_custom_carousel

パッケージ概要

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

完全にカスタマイズ可能でアニメーション付きのスクロール可能なリストを構築するための柔軟なFlutterウィジェットです。スナップポイントやモーメンタムなどの複雑なスクロールロジックを処理しつつ、ビジュアルデザインに対する完全な制御を可能にします。滑らかなアニメーションを備えた独自のカルーセル、カバーフロー、またはカスタムスワイプインターフェースを作成するのに最適です。開発者は事前定義されたテンプレートに縛られることなく、独自のアイテムレイアウトと遷移を定義できます。

用途

  • インタラクティブな製品スライダーの作成
  • アニメーションカバーフローインターフェースの構築
  • カスタムスワイプ可能なコンテンツギャラリーの設計
  • ダイナミックなビジュアルを活用したオンボーディング画面の実装
  • 応答性のある画像またはカードのカルーセルの開発

主な機能

  • 完全にカスタマイズ可能なアイテムウィジェット
  • 組み込みのアニメーションおよびスナップロジック
  • すべての主要プラットフォームをサポートしています
  • 軽量でパフォーマンスに優れる
  • 既存のFlutterプロジェクトとの簡単な統合
  • カスタムジェスチャーに対応して拡張可能

適している対象

  • 創造的な自由を求めるUIデザイナー
  • インタラクティブなアプリコンポーネントを開発する開発者
  • 独自のスクロール動作を必要とするプロジェクト
  • 豊富なメディアコンテンツを備えたアプリの表示
  • 再利用可能なカルーセルソリューションを望むチーム

注意事項

  • 各アイテムごとに手動でのレイアウト設計が必要です
  • パフォーマンスはアイテムの複雑さに依存します
  • 組み込みのスタイリングオプションが限られている
  • 高度な相互作用には追加の状態管理が必要になる可能性があります
  • 単純な静的リストには適していない

元の README

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

Flutter Custom Carousel

A widget for creating fully custom, animated scrollable lists. It manages all of the tricky logic surrounding scroll interactions and physics, and leaves the visual presentation of items up to you.

Includes an example app (shown above) with a variety of commented demos to learn from or customize.

Platforms / devices

Currently, this widget is designed for touch input. On desktop, scroll wheel input can fight with the settling scroll physics. Specifying different physics can resolve this at the cost of settling (aka snapping).

You can also enable scrolling via mouse dragging on desktop by setting a scrollBehavior. Check main.dart in the example to see it in use.

Similarly, the included examples target mobile handsets in portrait view to keep them concise. They include only basic responsiveness.

Basics

Simply pass in a list of children, and define an effectsBuilder function.

effectsBuilder accepts a child and its current relative scroll position (see scrollRatio below), and returns the child wrapped with widgets that apply the desired effects.

// very basic example that scrolls children vertically from -250px to +250px
CustomCarousel(
    children: [card1, card2, etc],
    effectsBuilder: (index, scrollRatio, child) =>
       Transform.translate(
            offset: Offset(0, scrollRatio * 250) ,
            child: child
       ),
)

You can further refine visuals by specifying how many children to display before and after the selection, whether to loop the list, a default alignment, and how to depth sort children.

Adjust interactions by changing the scroll direction, physics, & speed, enabling tap to select, or specifying handlers for when the selected item changes, or when it settles into position.

scrollRatio

The scrollRatio value ranges from -1 to +1, where 0 is the settled position of the selected item.

The following animation displays the scrollRatio for each item as it scrolls. It also highlights the "selected" item (white background), and the "settled" item (thick outline).

Try watching a single item at a time to see how the ratio relates to selection, settling, and items entering / exiting the visible list. Note that the specific values are dependent on factors like itemsBefore / itemsAfter.

ScrollControllers and ScrollPhysics

To facilitate item-oriented navigation and looping content CustomCarousel requires that you use CustomCarouselScrollController. This controller also provides useful features such as jumpToItem, animateToItem, nextItem, and previousItem, as well as smart defaults for animation durations and curves.

Similarly, CustomCarousel defaults to CustomCarouselScrollPhysics, which enables "settling" onto selected items (aka snapping). Adjust the behavior of the physics by setting the sticky and stiffness properties. You can use other scroll physics (such as BouncingScrollPhysics) if you don't want this functionality.

Using with Flutter Animate

You can also use Flutter Animate to define the effectsBuilder, leveraging it's broad collection of effects, such as fading, moving, blurs, shadows, shimmers, color effects, 2.5d flips, and more.

For example, the simple vertical scroller from above would look like this:

// very basic example that scrolls children vertically from -250px to +250px
CustomCarousel(
    children: [card1, card2, etc],
    effectsBuilder: CustomCarousel.effectsBuilderFromAnimate(
        effects: EffectList().moveY(begin: -250, end: 250),
    ),
)

A number of the included examples demonstrate this approach in more depth. See the docs for CustomCarousel.effectsBuilderFromAnimate() for more info.

API reference

For full documentation, see the API reference.

Installation

Grab it from pub.dev.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

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

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