搜索插件、代码仓与 APP 分类

yoda 封面
插件详情v1.0.1

yoda

Flutter 小部件,可将任何类型的子小部件切分为网格状的瓷砖,并以多种方式动画显示。目前支持爆炸、漩涡和雪花效果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
70
喜欢数
57
Pub 分数
130

安装插件

flutter pub add yoda

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Yoda 是一个 Flutter 小部件,可让开发者将任何子小部件划分为瓷砖网格,并使用各种效果(如爆炸、漩涡和雪花)进行动画处理。它专为在应用程序中创建动态且视觉上吸引人的过渡效果而设计。该包支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台,使其适用于跨平台开发。通过 pub add 简单集成,Yoda 可通过可自定义的动画增强用户界面的交互性。

适合场景

  • 创建动画启动画面
  • 设计页面之间的交互式过渡
  • 为按钮点击添加视觉效果
  • 动画显示图像或内容
  • 增强入门体验

主要特点

  • 基于瓦片的动画切片
  • 多种动画类型(爆炸、漩涡、雪花)
  • 跨平台兼容性
  • 与 pub 的轻松集成
  • 可自定义的动画参数
  • 跨设备的流畅性能

适合对象

  • 寻求创意动画的UI设计师
  • 开发交互式应用程序界面的开发者
  • 需要动态内容过渡的项目
  • 原型设计引人入胜的用户体验
  • 具有强大视觉叙事能力的应用程序

使用建议

  • 大量瓦片数量可能影响性能
  • 需要仔细调整才能实现流畅的动画
  • 仅限静态子部件,除非与状态管理结合使用
  • 不太适合简单、极简的设计
  • 动画复杂度可能增加构建时间

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Yoda Flutter plugin

Flutter widget that let's you slice any kind of child widget in a matrix of tiles and animate them with different kind of ways. Currently with Explode, Vortex and Flakes. Works on all platforms.

Screenshot

Yoda Widget Properties

Yoda widget
  • [yodaEffect] Animation effect to use (see below).
  • [controller] Animation controller.
  • [duration] Animation duration.
  • [startWhenTapped] Enable tap gesture to start animation.
  • [animParameters] Parameters used to animate tiles (see below).
  • [child] Whatever widget to slice.
YodaEffect enum
  • [Explosion]
  • [Vortex]
  • [Flakes]
AnimParameters properties
  • [yodaBarrier] Define which edges are barraged (see below).
  • [hTiles] Number of horizontal tiles to divide the child widget.
  • [vTiles] Number of vertical tiles to divide the child widget.
  • [fractionalCenter] Default center where force is given when not tapping on it.
  • [gravity] Vertical force.
  • [effectPower] Effect strength.
  • [blurPower] Blur strength.
  • [randomness] Random strength.
YodaBarrier properties
  • [left] Block tiles moving over the left edge.
  • [right] Block tiles moving over the right edge.
  • [top] Block tiles moving over the top edge.
  • [bottom] Block tiles moving over the bottom edge.

How to use

If you need to control the animation status:

late YodaController _yodaControllerExplode;
  
@override
  void initState() {
    super.initState();
    _yodaControllerExplode = YodaController()
    ..addStatusListener((status) {
      if (status == AnimationStatus.completed) {
        _yodaControllerExplode.reset();
      }
    });
  }

YodaController accepts start() and reset() methods. Note: calling those methods will not work when a setState() is called at the same time.

Yoda(
  yodaEffect: YodaEffect.Explosion,
  controller: _yodaControllerExplode,
  duration: Duration(milliseconds: 2500),
  animParameters: AnimParameters(
    yodaBarrier: YodaBarrier(bottom: true, left: true, right: true),
    fractionalCenter: Offset(0.5, 1.0),
    hTiles: 20,
    vTiles: 20,
    effectPower: 0.2,
    blurPower: 5,
    gravity: 0.1,
    randomness: 30,
  ),
  startWhenTapped: true,
  child: SizedBox(
    width: 250,
    height: 180,
    child: Image.asset('assets/dash.png', fit: BoxFit.fill)
  )
)

TODO
  • Find a better way to capture the widget
  • When changing Yoda widget parameters, 2 hot reloads are needed to make it to work!

所属分类

源码仓库

使用此插件的项目

暂无相关数据。