搜尋套件、儲存庫與 APP 分類

套件詳情v5.1.0

animate_do

受到 Animate.css 啟發的美觀動畫,提供可自訂的小部件動畫,無需外部依賴。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
9.9萬
喜歡數
4920
Pub 分數
160

安裝套件

flutter pub add animate_do

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Animate_do 是一個 Flutter 套件,提供受 Animate.css 啟發的視覺上吸引人的基於元件的動畫。它讓開發者能夠輕鬆地為 UI 元素應用流暢且可自訂的動畫,而不需依賴外部相依性。憑藉簡單的 API 和對所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)的支援,它透過動態過渡提升使用者體驗。該套件可無縫整合至 Flutter 應用中,為元件添加引人入勝的動態效果提供輕量級解決方案。

適用情境

  • 為UI元素添加進入動畫
  • 建立互動式按鈕回饋
  • 透過動態效果增強啟動畫面
  • 滾動時動畫列表或卡片
  • 改進入職體驗

主要特色

  • 受到 Animate.css 的啟發
  • 無外部依賴
  • 完全基於組件
  • 可自訂的動畫持續時間和延遲
  • 支援所有 Flutter 平台
  • 易於使用的 API

適合對象

  • Flutter 初學者尋求簡單的動畫
  • 開發互動式 UI 的開發者
  • 需要引人入勝的引導流程的應用程式
  • 專注於視覺美化之專案
  • 希望輕量級動畫解決方案的團隊

使用建議

  • 如果過度使用,可能會影響效能
  • 限於預定義的動畫類型
  • 不適合複雜的自訂動畫
  • 需要仔細調整以獲得最佳使用者體驗
  • 建議節制使用,以免造成分心

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

animate_do

A Flutter animation package inspired by Animate.css, built with zero external dependencies.

Dart 3 Null Safety Platforms pub.dev

Animate_do demo animation


Getting Started

Every animation widget ships with sensible defaults and is fully customizable. Drop it around any widget and you're done.


Properties

Property Type Description
key Key Optional widget key reference
child Widget Required widget to animate
duration Duration Duration of the animation
delay Duration Delay before the animation starts
from double Initial or final value for more pronounced slide/fade effects
animate bool Toggle false → true to trigger; works with setState, Bloc, Provider, Redux, etc.
infinite bool Loops the animation indefinitely
spins double Number of rotations — applies to Spin, Roulette, SpinPerfect
manualTrigger bool Disables auto-play; requires the controller callback to drive the animation
controller Function Exposes the AnimationController for advanced control
onFinish Function Callback fired when the animation completes; receives an AnimateDoDirection (forward / backward)
curve Curve Custom easing curve

Available Animations

Fade In
FadeIn FadeInDown FadeInDownBig FadeInUp
FadeInUpBig FadeInLeft FadeInLeftBig FadeInRight
FadeInRightBig
Fade Out
FadeOut FadeOutDown FadeOutDownBig FadeOutUp
FadeOutUpBig FadeOutLeft FadeOutLeftBig FadeOutRight
FadeOutRightBig
Bounce In
BounceInDown BounceInUp BounceInLeft BounceInRight
Elastic In
ElasticIn ElasticInDown ElasticInUp ElasticInLeft
ElasticInRight
Slide In
SlideInDown SlideInUp SlideInLeft SlideInRight
Back In / Back Out
BackInDown BackInUp BackInLeft BackInRight
BackOutDown BackOutUp BackOutLeft BackOutRight
Flip In
FlipInX FlipInY
Zoom
ZoomIn ZoomOut
Attention Seekers

All attention seekers support the infinite property to loop indefinitely.

Bounce Dance Flash Pulse
Flip Roulette ShakeX ShakeY
Spin SpinPerfect Swing HeartBeat
Wobble Jello Tada RubberBand
Custom Animations

These widgets let you move widgets around the screen and chain them with any other animation.

MoveTo MoveToArc

Two Syntaxes

Both syntaxes are fully supported. Use whichever feels more natural to you.

Sugar Syntax
Row(
  mainAxisAlignment: MainAxisAlignment.spaceAround,
  children: [
    const Square().fadeInLeft(),
    const Square().fadeInUp(),
    const Square().fadeInDown(),
    const Square().fadeInRight(),
  ],
)
Class Syntax
Row(
  mainAxisAlignment: MainAxisAlignment.spaceAround,
  children: [
    FadeInLeft(child: Square()),
    FadeInUp(child: Square()),
    FadeInDown(child: Square()),
    FadeInRight(child: Square()),
  ],
)

Animation Chaining

Chain multiple animations sequentially using the sugar syntax:

Square()
  .tada()
  .wobble()
  .fadeIn()
Chaining with custom animations
const Square()
  .moveTo(top: 30)
  .moveTo(
    left: 30,
    delay: const Duration(seconds: 1),
  )
  .moveToArc(
    bottom: 30,
    right: 30,
    delay: const Duration(seconds: 2),
  )
  .fadeOut(
    delay: const Duration(seconds: 2),
  )

Triggering Animations

Toggle with animate

Set animate: true to play forward, animate: false to reverse. Works with any state management solution.

Animate_do animate property

FadeIn(animate: animate, child: const Square())
FadeInUp(animate: animate, child: const Square())
FadeInDown(animate: animate, child: const Square())
FadeInLeft(animate: animate, child: const Square())
FadeInRight(animate: animate, child: const Square())

Events — onFinish

The onFinish callback fires when an animation completes, passing an AnimateDoDirection value (forward or backward).

Sugar syntax

const Square().fadeIn(
  animate: animate,
  delay: const Duration(milliseconds: 100),
  onFinish: (direction) => print('$direction'),
),

Class syntax

FadeIn(
  animate: animate,
  delay: const Duration(milliseconds: 100),
  onFinish: (direction) => print('$direction'),
  child: const Square(),
),

Manual Trigger

Use manualTrigger: true together with the controller callback to drive the animation yourself — useful when you need full control over playback.

Note: When using manualTrigger, you are responsible for calling controller.forward() and controller.reverse() explicitly.

class _MyWidgetState extends State<MyWidget> {
  late AnimationController animateController;

  @override
  Widget build(BuildContext context) {
    return FadeInUp(
      manualTrigger: true,
      controller: (controller) => animateController = controller,
      child: YourWidget(),
    );
  }
}

Demos

Animate_do demo

Animate_do demo

Animate_do demo

Animate_do demo

For complete runnable examples, see the example folder.


If you find this package useful, consider leaving a like on pub.dev. Feedback and suggestions are always welcome.

所屬分類

原始碼儲存庫

使用此套件的專案