long_press_animation_button 0.0.2
long_press_animation_button: ^0.0.2 copied to clipboard
A Flutter package that implement loading buttons activated by long-press gestures with animation
Long Press Animation Button #
The long_press_animation_button
package for Flutter is designed that implement loading buttons activated by long-press gestures with animation.
Features #
- onTap()
- onLongPress()
- onLongPressCancel()
Getting started #
Add the package to your
pubspec.yaml
file:
dependencies:
long_press_animation_button: <latest version>
Import the Package:
import 'package:long_press_animation_button/long_press_animation_button.dart';
Implement Widget:
LongPressAnimationButton(
onLongPress: () => print('Click !'),
child: Text("Long Press Animation Button"),
),
Usage #
Create a String variable:
String _text = 'ready for checkout';
View Data of String Variable:
Text(
_text,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
Implement Long Press Animation Button:
LongPressAnimationButton(
onTap:
() => setState(() {
_text = 'Long Press To Checkout.\n-- onTap() --';
}),
onLongPressCancel:
() => setState(() {
_text = 'Checkout Cancel !\n-- onLongPressCancel() --';
}),
onLongPress:
() => setState(() {
_text = 'CHECKOUT SUCCESS :)\n-- onLongPress() --';
}),
height: 80,
width: 200,
backgroundColor: Colors.tealAccent,
loadingColor: Colors.yellow,
borderRadius: 12,
border: Border.all(width: 4, color: Colors.orange),
child: Text(
'Checkout',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: Colors.brown,
),
),
),
Limitation #
Android | iOS | MacOS | Web | Linux | Windows |
---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Additional information #
long_press_animation_button
plugin is developed by Mahadi Hassan