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

bounce 封面
插件详情v1.0.2

bounce

一个动画小部件,根据触摸位置对其子项进行平滑的缩放和旋转动画。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1130
喜欢数
52
Pub 分数
150

安装插件

flutter pub add bounce

插件介绍

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

Bounce 包提供了一个 Flutter 小部件,当被触摸时,其子组件会添加平滑的缩放和旋转动画。它通过动态响应触摸输入来增强用户交互,创造出一种活泼且引人入胜的反馈效果。适用于按钮、卡片或任何交互元素,可在 Android、iOS、Web、macOS、Windows 和 Linux 等所有主要平台上使用。该动画流畅且可自定义,设置简单。特别有助于提升数字界面的触觉体验。

适合场景

  • 交互式按钮
  • 卡片的触摸反馈
  • 游戏化用户界面元素
  • 移动应用微交互
  • Web 界面增强功能

主要特点

  • 平滑缩放和旋转动画
  • 基于触摸的触发
  • 跨平台支持
  • 最小配置
  • 对触摸位置敏感

适合对象

  • 寻求互动反馈的应用开发者
  • 设计师通过动态效果提升用户体验
  • 需要轻量级动画的项目
  • Flutter 初学者探索手势
  • 触摸操作密集型应用

使用建议

  • 可能不适合极简设计风格
  • 复杂布局上的性能影响
  • 除了缩放和旋转外,自定义功能有限
  • 建议谨慎使用,以避免分散注意力
  • 需要处理手势检测

原始 README

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

Bounce

pub package

This package adds a new Bounce widget that applies a tap-triggered bounce animation to Flutter widgets. Depending on the touch location, a tilt effect is also added on the child.

"Demo of the Bounce plugin"

To see examples of the following effect on a device or simulator:

cd example/
flutter run --release

How to use

First, add the dependency to your pubspec.yaml file:

dependencies:
  bounce: ^<latest-version>

Then, wrap your target widget as child of a Bounce widget. You may optionally specify additional behavior, such as disabling the tilt effect by adding tilt: false to the constructor. The simplest usage of this widget is the following :


import 'package:bounce/bounce.dart';

...

return Bounce(
        onTap: () {
          // ...
        },
        child: ...)

Custom behavior

Tilt effect

You may specify the maximum angle applied by the tilt effect using the tiltAngle. This angle will be reached when the child widget is tapped at its edges. No tilt is applied when the child is tapped exactly at its center.

Scale effect

You may specify the maximum factor applied by the scale effect using the scaleFactor parameter.

Tap delay

To fine tune your user experience, you may want the various effects to animate back for a few milliseconds after the tap has occured. By default, this delay is set to 150 milliseconds.

Filter quality

The Bounce widget implementation wraps the child with a matrix-based Transform widget. On most platforms, it is a good practice to have it set to FilterQuality.high, which is the default value. You may specify other FilterQuality values directly from the widget's constructor :

  Bounce(
    filterQuality: FilterQuality.medium,
    child: ...
  )

Due to limitations on Safari iOS and if your app targets it, you are responsible for enforcing filterQuality to null in this specific browser.

Combination with Motion widgets

Bounce widgets look gorgeous when combined with a Motion widget, like so :

  Motion(
    child: Bounce(
      child: ...
    )
  )

Here is an interaction example :

"Bounce + Motion example"

Comparing different tilt angles

Issues

If you are having any problem with the Bounce package, you can file an issue on the package repo's issue tracker.

Please make sure that your concern hasn't already been addressed in the 'Closed' section.

Credits

This package was developed with ♥ by @mrcendre.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。