A Flutter package that adds swipe-to-reveal-action buttons to any widget. Supports revealing one or two action buttons with fully customizable colors, sizes, and callbacks.
- Swipe left on any widget to reveal action buttons
- Choose between one button (
SwipeLeft) or two buttons (SwipeLeft2Buttons) - Customizable button titles, colors, sizes, and actions
- Smooth slide animation
Add swipe_left to your pubspec.yaml:
dependencies:
swipe_left:
git:
url: https://github.com/kylebessemer/swipe_leftSwipeLeft(
height: 75,
backgroundColor: Colors.white,
buttonFontSize: 12.0,
buttonWidth: 75.0,
buttonTitle: 'Delete',
buttonBackgroundColor: Colors.red,
buttonFontColor: Colors.white,
buttonAction: () {
// your action code here
},
child: Container(
height: 75,
width: MediaQuery.of(context).size.width,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(Icons.account_balance),
Text("My Swipe Left Button"),
],
),
),
)SwipeLeft2Buttons(
height: 75,
backgroundColor: Colors.white,
buttonFontSize: 12.0,
buttonWidth: 75.0,
button1Title: 'Info',
button1BackgroundColor: Colors.blue,
button1FontColor: Colors.white,
button2Title: 'Delete',
button2BackgroundColor: Colors.red,
button2FontColor: Colors.white,
button1Action: () {
// your action code here
},
button2Action: () {
// your action code here
},
child: Container(
height: 75,
width: MediaQuery.of(context).size.width,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(Icons.account_balance),
Text("My Swipe Left Button"),
],
),
),
)| Parameter | Type | Description |
|---|---|---|
height |
double |
Height of the widget |
backgroundColor |
Color |
Background color behind the button |
buttonTitle |
String |
Button label text |
buttonBackgroundColor |
Color |
Button background color |
buttonFontColor |
Color |
Button text color |
buttonFontSize |
double |
Button text size |
buttonWidth |
double |
Button width |
buttonAction |
VoidCallback |
Callback when the button is tapped |
child |
Widget |
The widget displayed on top |
Same as SwipeLeft, but with button1* and button2* prefixed parameters for each button.
MIT License. See LICENSE for details.