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

spring_button 封面
插件详情v2.0.0

spring_button

一个简单的 widget,用于包含响应手势的弹簧动画的子 widget。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2110
喜欢数
42
Pub 分数
140

安装插件

flutter pub add spring_button

插件介绍

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

SpringButton 是一个 Flutter 小部件,当子小部件被按下或交互时,会为其添加类似弹簧的动画效果。它通过在点击或拖动等手势上提供流畅、弹跳的反馈来增强用户体验。该动画可自定义,并可在所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上正常工作。非常适合创建具有动态响应的吸引人按钮和交互式 UI 元素。

适合场景

  • 创建带有触觉反馈的动画按钮
  • 增强移动应用中的触摸交互
  • 为网页界面添加有趣的特效
  • 提高表单和控件的用户参与度
  • 为跨平台应用设计响应式UI组件

主要特点

  • 按下时的弹簧动画
  • 可自定义的动画曲线
  • 跨平台兼容性
  • 与现有控件的简单集成
  • 支持点击和拖拽手势

适合对象

  • 寻求交互式 UI 元素的开发者
  • 想要趣味按钮动画的设计人员
  • 注重用户体验的应用
  • 跨平台 Flutter 项目
  • 原型化交互功能

使用建议

  • 如果过度使用,可能会影响性能
  • 需要仔细调整弹簧参数
  • 不适合极简设计
  • 仅限基于手势的交互
  • 动画可能不适合注重可访问性的应用

原始 README

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

spring_button

Cosmos Software

Pub License

A simple widget for having child widgets that respond to gestures with a spring animation.

Media | Description | How-to-Use

Media

Watch on Youtube:

v1.0.0



Description

This is a simple widget for having child widgets that respond to gestures with a spring animation.

It is more of an extension to the GestureDetector widget than an original new widget.

How-to-Use

Simply create a SpringButton as shown in the example:

SpringButton(
    SpringButtonType.OnlyScale, //springButtonType
    uiChild(),                  //uiChild
    {Key key,
    useCache            : true,
    alignment           : Alignment.center,
    scaleCoefficient    : 0.75,
    onTapDown,
    onTapUp,
    onTap,
    onTapCancel,
    onSecondaryTapDown,
    onSecondaryTapUp,
    onSecondaryTapCancel,
    onDoubleTap,
    onLongPress,
    onLongPressStart,
    onLongPressMoveUpdate,
    onLongPressUp,
    onLongPressEnd,
    onVerticalDragDown,
    onVerticalDragStart,
    onVerticalDragUpdate,
    onVerticalDragEnd,
    onVerticalDragCancel,
    onHorizontalDragDown,
    onHorizontalDragStart,
    onHorizontalDragUpdate,
    onHorizontalDragEnd,
    onHorizontalDragCancel,
    onForcePressStart,
    onForcePressPeak,
    onForcePressUpdate,
    onForcePressEnd,
    onPanDown,
    onPanStart,
    onPanUpdate,
    onPanEnd,
    onPanCancel,
    onScaleStart,
    onScaleUpdate,
    onScaleEnd})
    
Widget uiChild() {}

Further Explanations:

For a complete set of descriptions for all parameters and methods, see the documentation.

  • SpringButton, as you can see, is very similar to a GestureDetector widget so it should be familiar.

Notes

I started using and learning Flutter only some weeks ago so this package might have some parts that don't make sense, that should be completely different, that could be much better, etc. Please let me know! Nicely!

Any help, suggestion or criticism is appreciated!

Cheers.





所属分类

源码仓库

使用此插件的项目