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

flip_card のカバー
パッケージ詳細v0.7.0

flip_card

カードの裏返しアニメーションを提供するコンポーネントです。製品の詳細を非表示および表示するために使用できます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
9.6万
いいね数
956
Pub ポイント
135

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

flutter pub add flip_card

パッケージ概要

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

FlipCard は、滑らかなカードの裏返しアニメーションを可能にする Flutter パッケージで、製品情報などの追加情報を表示するのに最適です。カスタマイズ可能な前面と背面ウィジェットをサポートしており、インタラクティブな切り替えが可能で、魅力的なユーザーインターフェースに最適です。このパッケージは Android、iOS、Web、macOS、Windows、Linux などすべての主要プラットフォームで動作し、一貫した挙動を保証します。pub add を通じた簡単な統合により、複雑さなく UI のインタラクティビティを向上させます。

用途

  • 製品詳細の公開
  • インタラクティブな学習カード
  • 前後比較
  • ユーザー プロファイルの切り替え
  • ゲーム化されたUI要素

主な機能

  • スムーズな裏返しアニメーション
  • カスタマイズ可能な前面および背面コンテンツ
  • クロスプラットフォーム対応
  • Flutter との簡単な統合
  • ジェスチャーによるフリップ
  • 設定可能な速度と方向

適している対象

  • ECアプリ
  • 教育アプリ
  • インタラクティブなチュートリアル
  • ダッシュボードウィジェット
  • UIプロトタイピング

注意事項

  • 低価格端末でのパフォーマンスに影響を与える可能性があります
  • アクセシビリティを考慮した慎重な設計が必要です
  • 2Dのフリップ効果に限定
  • 複雑な遷移には適していない
  • アニメーションは他のジェスチャーと競合する可能性があります

元の README

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

flip_card PRs Welcome Pub Package

A component that provides a flip card animation. It could be used for hiding and showing details of a product.

How to use

Import the package

import 'package:flip_card/flip_card.dart';
Default

Create a flip card as shown below. By default the card is touch controlled.

You can turn off touch control by setting flipOnTouch to false.

FlipCard(
  fill: Fill.fillBack, // Fill the back side of the card to make in the same size as the front.
  direction: Axis.horizontal, // default
  initialSide: CardSide.front, // The side to initially display.
  front: Container(
    child: Text('Front'),
  ),
  back: Container(
    child: Text('Back'),
  ),
)
Programmatically
Controller (Recommended)

To control the card programmatically, you can pass a controller when creating the card.

late FlipCardController _controller = FlipCardController();

@override
Widget build(BuildContext context) {
  return FlipCard(
    controller: _controller,
    front: ...,
    back: ...,
  );
}

void doStuff() {
  // Flip the card a bit and back to indicate that it can be flipped (for example on page load)
  _controller.hint(
    duration: const Duration(milliseconds: 400),
  );

  // Tilt the card a bit (for example when hovering)
  _controller.skew(0.2);

  // Flip the card programmatically
  _controller.flip();

  // Flip the card to front specifically
  _controller.flip(CardSide.front);

  // Flip the card without animation
  _controller.flipWithoutAnimation();
}
Global Key

You can also control the card via a global key as shown below.

This is not the recommended way.

final cardKey = GlobalKey<FlipCardState>();

@override
Widget build(BuildContext context) {
  return FlipCard(
    key: cardKey,
    flipOnTouch: false,
    front: Container(
      child: RaisedButton(
        onPressed: () => cardKey.currentState.toggleCard(),
        child: Text('Toggle'),
      ),
    ),
    back: Container(
      child: Text('Back'),
    ),
  );
}
Timed

You can auto-flip the widget after a certain delay without any external triggering.

FlipCard(
  fill: Fill.back, // Fill the back side of the card to make in the same size as the front.
  direction: Axis.horizontal, // default
  initialSide: CardSide.front, // The side to initially display.
  front: Container(
    child: Text('Front'),
  ),
  back: Container(
    child: Text('Back'),
  ),
  autoFlipDuration: const Duration(seconds: 2), // The flip effect will work automatically after the 2 seconds
)

カテゴリー

ソースリポジトリ

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