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

animated_cross_fade_plus のカバー
パッケージ詳細v0.0.4

animated_cross_fade_plus

複数の子要素とカスタマイズ可能なアニメーションをサポートする、AnimatedCrossFade の拡張バージョンを提供する Flutter パッケージです。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
61
いいね数
7
Pub ポイント
160

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

flutter pub add animated_cross_fade_plus

パッケージ概要

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

AnimatedCrossFadePlus は、Flutter の AnimatedCrossFade を複数の子要素をサポートし、カスタマイズ可能なアニメーションを提供することで強化しています。2つ以上のウィジェット間でスムーズな遷移を可能にし、複雑な状態変更を持つダイナミックUIに最適です。このパッケージは、フェード期間、カーブ、アラインメントなどの柔軟な設定オプションにより、コア機能を拡張し、プラットフォーム間で滑らかで応答性のある視覚効果を実現します。ボイラープレートコードなしで高度なトランジション制御を求める開発者向けに設計されています。

用途

  • マルチウィジェット状態遷移
  • 動的UIコンテンツの切り替え
  • カスタマイズ可能なフェードアニメーション
  • 複雑な画面遷移
  • インタラクティブなアプリインターフェース
  • スムーズなテーマまたはモードの切り替え

主な機能

  • 複数の子要素のサポート
  • カスタマイズ可能なアニメーションカーブ
  • 設定可能なフェード期間
  • 柔軟な配置オプション
  • クロスプラットフォーム互換性
  • 最小限のセットアップが必要

適している対象

  • 複数状態遷移が必要な開発者
  • 滑らかなアニメーションに注力するUIデザイナー
  • 動的コンテンツ切り替えを持つアプリ
  • 再利用可能な遷移コンポーネントを必要とするプロジェクト
  • インタラクティブなダッシュボードやウィザードを構築するチーム

注意事項

  • 多くの子要素があると複雑さが増す可能性があります
  • アニメーションパラメータの正確な調整が必要です
  • 単純な1対1の遷移には適していません
  • 重いウィジェットを使用した際のパフォーマンスへの影響
  • 基本的な使用方法以外のドキュメントは限られている
  • 軽量または最適化された子ウィジェットと併用するのが最適です

元の README

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

Animated Cross Fade Plus

A powerful Flutter package that enhances the traditional AnimatedCrossFade widget with support for multiple children, auto-play capabilities, and smooth transitions.

pub package github likes license

Demo

Auto-Play Carousel

Auto-play Demo

Manual Navigation

Manual Navigation Demo

Youtube Video

🎥 Check out the tutorial video on my YouTube channel to see it in action! Youtube video

Features 🚀

  • ✨ Support for unlimited children (not just two like AnimatedCrossFade)
  • 🎮 Manual navigation controls
  • 🎯 Auto-play functionality
  • 🎨 Multiple transition types (fade, slide, scale, slideAndFade)
  • 📱 Separate enter and exit animations
  • 🎭 Customizable transition configurations
  • 🔄 Built-in play/pause controls
  • 📍 Progress indicators

Installation 💻

Add this to your package's pubspec.yaml file:

dependencies:
  animated_cross_fade_plus: ^0.0.4

Usage 🎯

Basic Auto-Play Carousel
class AutoPlayExample extends StatefulWidget {
  @override
  _AutoPlayExampleState createState() => _AutoPlayExampleState();
}

class _AutoPlayExampleState extends State<AutoPlayExample> {
  final List<SlideContent> _slides = [
    SlideContent(
      title: 'Welcome',
      gradient: [Colors.purple, Colors.blue],
      icon: Icons.rocket_launch,
    ),
    SlideContent(
      title: 'Easy to Use',
      gradient: [Colors.orange, Colors.red],
      icon: Icons.touch_app,
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return AnimatedCrossFadePlus(
      children: _slides.map((slide) => _buildSlide(slide)).toList(),
      transitionType: CrossFadeTransitionType.scale,
      enterConfig: const TransitionConfig(
        curve: Curves.easeInOutCubic,
        duration: Duration(milliseconds: 1000),
      ),
      exitConfig: const TransitionConfig(
        curve: Curves.easeInOutCubic,
        duration: Duration(milliseconds: 1000),
      ),
      autoPlay: true,
      autoPlayDuration: const Duration(seconds: 3),
    );
  }
}
Manual Navigation Carousel
class ManualExample extends StatefulWidget {
  @override
  _ManualExampleState createState() => _ManualExampleState();
}

class _ManualExampleState extends State<ManualExample> {
  final GlobalKey<AnimatedCrossFadePlusState> _key = GlobalKey();
  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        AnimatedCrossFadePlus(
          key: _key,
          children: _items.map((item) => _buildItem(item)).toList(),
          transitionType: CrossFadeTransitionType.slideAndFade,
          enterConfig: const TransitionConfig(
            curve: Curves.easeInOutCubic,
            duration: Duration(milliseconds: 800),
            direction: AxisDirection.left,
          ),
          exitConfig: const TransitionConfig(
            curve: Curves.easeInOutCubic,
            duration: Duration(milliseconds: 800),
            direction: AxisDirection.right,
          ),
          onIndexChanged: (index) => setState(() => _currentIndex = index),
        ),
        Row(
          children: [
            ElevatedButton(
              onPressed: () => _key.currentState?.animateToIndex((_currentIndex - 1) % _items.length),
              child: Text('Previous'),
            ),
            ElevatedButton(
              onPressed: () => _key.currentState?.animateToIndex((_currentIndex + 1) % _items.length),
              child: Text('Next'),
            ),
          ],
        ),
      ],
    );
  }
}

Parameters ⚙️

Parameter Type Description
children List List of widgets to animate between
transitionType CrossFadeTransitionType Type of transition animation
enterConfig TransitionConfig Configuration for entering widget animation
exitConfig TransitionConfig Configuration for exiting widget animation
initialIndex int Starting index
autoPlay bool Enable/disable auto-play
autoPlayDuration Duration? Time between auto-play transitions
alignment AlignmentGeometry Alignment of children
constraints BoxConstraints? Optional size constraints
clipChildren bool Whether to clip children during animation
onIndexChanged Function(int)? Callback when index changes

Transition Types 🎭

enum CrossFadeTransitionType {
  fade,           // Simple fade transition
  slide,          // Slide animation
  scale,          // Scale animation
  slideAndFade,   // Combined slide and fade
}

TransitionConfig Properties 🛠️

class TransitionConfig {
  final Curve curve;              // Animation curve
  final Duration duration;        // Animation duration
  final AxisDirection direction;  // Slide direction (for slide transitions)

  const TransitionConfig({
    this.curve = Curves.linear,
    this.duration = const Duration(milliseconds: 300),
    this.direction = AxisDirection.right,
  });
}

Controller Methods 🎮

final GlobalKey<AnimatedCrossFadePlusState> _key = GlobalKey();

// Navigation
_key.currentState?.animateToIndex(2);   // Navigate to specific index

// Auto-play control is handled through the autoPlay property
// Toggle by updating the widget's autoPlay value

Complete Examples 📱

Check out the example folder for complete implementation examples:

  • Auto-play carousel with scale transitions
  • Manual navigation with slide and fade transitions
  • Progress indicators
  • Play/pause controls

Contributing 🤝

Contributions are welcome! Please feel free to submit issues and pull requests.

  1. Fork it
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -am 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

License 📄

This project is licensed under the MIT License - see the LICENSE file for details.

Maintainers 👥

カテゴリー

ソースリポジトリ

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

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