BounceTapper는 앱의 터치 상호작용을 향상시키기 위해 부드러운 탭 반동 애니메이션(수축 및 확장 효과)을 추가하는 Flutter 패키지입니다. 사용자의 탭에 유연하고 자연스러운 애니메이션으로 반응하는 사용하기 쉬운 위젯을 제공하여 피드백과 참여도를 개선합니다. 버튼, 카드 또는 시각적 반응이 중요한 모든 인터랙티브 요소에 이상적입니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 주요 플랫폼을 모두 지원하며 장치 간 일관된 동작을 보장합니다. `flutter pub add bounce_tapper`를 통해 최소한의 설정으로 개발자는 UI에 완성도 높은 터치 피드백을 신속하게 통합할 수 있습니다.
사용 사례
버튼 피드백 향상
카드 탭 상호작용 개선
동적 터치 반응 추가
매력적인 UI 요소 만들기
다중 플랫폼 애니메이션 지원
주요 기능
부드러운 수축/확장 애니메이션
최소 코드로 간편한 통합
크로스 플랫폼 호환성
사용자 지정 가능한 애니메이션 속도
내장 터치 피드백
경량이며 성능이 뛰어남
적합한 대상
상호작용 피드백을 원하는 UI 디자이너
터치 중심 인터페이스를 개발하는 개발자
반응형 터치 요소가 필요한 앱
정교한 마이크로 인터랙션을 목표로 하는 프로젝트
다중 플랫폼을 대상으로 하는 팀
고려 사항
저사양 기기에서 최적의 성능을 위해 조정이 필요할 수 있습니다
특정 디자인 요구 사항을 위해 애니메이션 동작 조정이 필요할 수 있습니다
간단하고 집중된 터치 타겟과 함께 사용하는 것이 가장 좋습니다
복잡한 제스처 기반 상호작용에 적합하지 않음
기본 반동 파라미터를 초과한 사용자 정의는 제한적
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Bounce Tapper
BounceTapper allows you to effortlessly apply smooth Bounce (Shrink/Grow) touch animations to your widgets. Beyond the basic Shrink/Grow animations, the package is infused with carefully optimized interaction behaviors. Major apps like the App Store, GitHub, and Slack have adopted similar touch interactions, and BounceTapper brings you refined interaction logic inspired by a thorough analysis of these leading applications.
Demo
Can apply exactly the same touch interactions as in the demo apps.
Key Features
🔑 Extremely easy to use
💻 Easily integrates with your existing widgets
🛠 Highly customizable
🔥 Various touch interaction logic carefully considered
Installing
To use the Easy BounceTapper package in your Flutter project, follow these steps:
Depend on it
Add the following line to your project's pubspec.yaml file under the dependencies section:
dependencies:bounce_tapper:^1.1.4
Install it
Run the following command in your terminal or command prompt:
$ flutter pub get
Import it
Add the following import statement to your Dart code:
import'package:bounce_tapper/bounce_tapper.dart';
Usage
It's incredibly simple. Just wrap the widget you want to apply the Shrink/Grow touch interaction to with BounceTapper.
Pass the necessary touch events to the onTap method. If you have an existing custom widget that handles touch events, you can skip passing an onTap event directly.
/// 1. Executes the touch event inside BounceTapperBounceTapper(
onTap: () {
/// Touch Event!
},
child: CustomWidget(),
)
/// 2. Listens to the child widget's touch event and executes itBounceTapper(
child: CustomButton(),
)
The onTap property is optional, so if your child widget handles touch events on its own, the Shrink/Grow animation will still be triggered even without passing a touch event to BounceTapper.
Features
BounceTapper not only offers Shrink/Grow touch animations but also provides various finely-tuned features.
1. Cancel ongoing interaction when scrolling
If you carefully observe the App Store's main page, you’ll notice that when a card view is touched and shrinks, scrolling will cancel the shrink and return the card to its original state without triggering the touch event.
BounceTapper works similarly by detecting scroll events from parent widgets and canceling the ongoing shrink animation, restoring the widget without triggering a touch event. If you prefer to keep the animation and event active even when scrolling, you can set the disableGrowOnScroll property to false.
Both vertical and horizontal scroll events are detected.
Parameter
Default
Description
disableBounceOnScroll
true
Whether to cancel ongoing animation during scroll
2. Customize Shrink/Grow animation
You can customize several aspects of the Shrink/Grow animation, such as the animation duration and the shrink size.
Although the default property values are set to feel quite natural, you can customize them if necessary.
Parameter
Default
Description
shrinkScaleFactor
0.965
The scale to which the widget shrinks
shrinkDuration
Duration(milliseconds: 160)
Duration of the shrinking animation
growDuration
Duration(milliseconds: 120)
Duration of the growing animation
delayedDurationBeforeGrow
Duration(milliseconds: 60)
Delay before growing to ensure a smooth animation
shrinkCurve
Curves.easeInSine
Curve used for the shrinking animation
growCurve
Curves.easeOutSine
Curve used for the growing animation
enable
true
Whether to enable touch animation and events
3. Highlight effect on touch
Just like InkWell or MaterialButton, BounceTapper also provides a highlight effect when the widget is touched, overlaying a color on the widget. You can customize the highlight color using the highlightColor property. If you don’t want any highlight effect, simply set it to Colors.transparent.
In some cases, using a widget like InkWell on a child widget with a borderRadius might cause the highlight to not clip properly, requiring you to wrap it in a ClipRRect widget.
However, BounceTapper automatically detects the nearest borderRadius from the child widget’s renderObject and clips the corners accordingly.
There are a few widgets for which renderObject cannot detect the borderRadius. In these cases, you can manually set the highlightBorderRadius to clip the highlight box with the correct radius.
BounceTapper does not interfere with the highlight touch effects of wrapped widgets like FilledButton or InkWell.
Parameter
Default
Description
highlightColor
Color(0x1F939BAC)
The color overlayed on touch
highlightBorderRadius
null
The borderRadius of the highlight box
4. Interaction with parent/child BounceTapper widgets
There may be cases where you need to apply another BounceTapper to a child widget within a parent BounceTapper. In such scenarios, separate touch events are triggered when the child widget is touched and when the parent widget (excluding the child) is touched. Shrink/Grow animations are applied only to the child when it is touched, while the entire parent (including the child) will shrink/grow when the parent is touched.
5. Support for various touch gestures
In addition to the onTap method, BounceTapper supports gestures like onLongPress and onLongPressUp. However, you can only assign either onTap or onLongPressUp, not both. Attempting to set both will result in an assertion error to prevent conflicting interactions.
Additionally, if you want to disable touch events and animations entirely, simply set the enable property to false.
Parameter
Default
Description
onTap
null
Method to be executed on tap
onLongPress
null
Method to be executed on long press
onLongPressUp
null
Method to be executed when long press is released
enable
true
Whether to enable touch animations and events
6. Prevent multiple and rapid touches
By default, the BounceTapper package prevents multiple rapid touches and simultaneous touches, ensuring that touch events aren’t triggered multiple times. If multiple BounceTapper widgets are touched at the same time, only the one that was touched first will trigger its animation and event.
7. Interaction when touch moves outside the touch area
If the widget is touched and shrinks, but the touch point moves outside the widget’s touch area, the ongoing animation will be canceled and the widget will grow back to its original size. And the touch event will not be triggered.