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

flutter_bounce 封面
插件详情v1.1.0

flutter_bounce

一个高效的 Flutter 包,用于在点击时对包裹的 widget 实现弹跳动画。它适用于 iOS 和 Android 两大移动平台。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1150
喜欢数
162
Pub 分数
140

安装插件

flutter pub add flutter_bounce

插件介绍

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

flutter_bounce 是一个轻量且高效的 Flutter 包,可为任何包装的 widget 添加平滑的点击弹跳动画。专为 iOS 和 Android 设计,它通过细微而响应迅速的反馈来增强用户交互体验。该包可无缝集成到现有 UI 中,且无性能开销,非常适合按钮、卡片和其他交互元素。它支持多种平台,包括 Web、macOS、Windows 和 Linux,确保在各种设备上行为一致。

适合场景

  • 为按钮添加触觉反馈
  • 增强卡片点击交互
  • 提高应用程序的响应速度
  • 创建引人入胜的用户界面微交互
  • 支持跨平台一致性

主要特点

  • 点击弹跳动画
  • 轻量且高效
  • 跨平台支持
  • 轻松集成
  • 可自定义的动画强度

适合对象

  • 移动应用开发人员
  • UI/UX 设计师
  • 交互式原型构建器
  • 跨平台应用开发者
  • 需要细微触觉反馈的应用

使用建议

  • 仅限基于点击的动画
  • 无高级动画自定义
  • 可能与其他手势检测器冲突
  • 最适合简单的交互元素
  • 不适用于复杂的动画序列

原始 README

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

flutter_bounce

pub_package git_license build

  • An efficient flutter package for an on-tap bounce animation on any flutter widgets
  • This package is an enhanced version of bouncing_widget.
  • Limitation of the bouncing_widget package:
    • It is not efficient for the widgets in Scroll Pages. We cannot scroll while having our fingers on the widget
    • The same issue would be found here

Advantages of flutter_bounce

  • Flutter bounce package will give you full freedom, to be used in on both the static and dynamic like scrolling pages.
  • Not sticky on scrolling, efficient bounce effect every where
  • With Duration, controll the bounce animation
  • It doesn't let the widget stay pressed when you scroll through, if we use the normal bounce effect with simply using the Flutter AnimationController and Tranform.scale() Widget.

Disclaimer

  • Widget flutter_widget is not the copy paste of bouncing_widget, it works differently. Without limitations, and the functionality works differently, based upon the duration, and not on the scaleFactor.
  • It doesn't have the scaleFactor at all, which is required in the widget
  • The code written in such a way that supports the flutter_bounce functionality. However, I have taken motivation from the limitations of the bouncing_widget

Usage

To use this plugin, add flutter_bounce as a dependency in your pubspec.yaml file.

Demo

This is how the Bounce Widget works when wrapped around the widget. The below shows Bounce being used in both the scenario:

  1. Static Page with Duration set facility
  2. Scroll Page with default Duration as 100 ms:
    • Horizontal Scroll
    • Vertical Scroll

Example

  • Import the library
import 'package:flutter_bounce/flutter_bounce.dart';
  • In order to use this package, we just need to wrap the content with the widget Bounce.
  • child, duration and onPressed is mandatory in the widget.
  • However, onPressed and duration can have null in the widget. By default duration is set to 100 milliseconds.
  • Please Note: Always pass the duration in milliseconds for best result
Bounce(
  duration: Duration(milliseconds: 110),
  onPressed: (){ YOUR_FUNCTION },
  child: YOUR_WIDGET
)

Acknowledgement

  • I would like to thank Levent Kantaroğlu for contributing in the recent null safety addition to the code, which will now help the community to use this package efficiently.
  • I would like to thank ThomasEcalle for the indirect motivation via his widget, to come up with an efficient work around, which will now be useful for our flutter community people

所属分类

源码仓库

使用此插件的项目