flutter - 使用 GestureDetector 的 onLongPressStart 每秒调整图标大小
问题描述
这个问题与Messenger的图标非常相似。只要你按下那个图标,它就会变大。
这会很有趣,其他人很快就会使用!
我是新手,但如果有人对如何实现这一点有想法,我非常愿意提供帮助。
解决方案
您可以使用接受动画值的ScaleTransition小部件
_controller = AnimationController(duration: const Duration(milliseconds: 2000), vsync: this, value: 0.1);
_animation = CurvedAnimation(parent: _controller, curve: Curves.bounceInOut);
ScaleTransition(
scale: _animation,
alignment: Alignment.center,
child: child
)
并在您的 longPress 中调用
_controller.forward();
推荐阅读
- jquery - 无法识别附加的复选框
- javascript - 为什么方法 setValue 的输出与 Browser.msgBox 不同?
- c++ - 如何在不使用 C++ 中的函数的情况下显示链表中的元素?
- javascript - 我在包控制中找不到 EJS2
- angular - 是否可以使用 Angular 获取任何 URI 的 HTML 页面?
- swift - 谁能告诉我为什么当我按下凸轮按钮时我的应用程序崩溃了
- rust - 如何在不调用其中一个函数的情况下链接 C 库?
- azure-web-app-service - 移动浏览器无法查看 Azure 网站
- c++ - 使用“typename Container::value_type”作为返回值时无法推断模板参数
- typescript - 推断 TypeScript 泛型类类型