Member-only story
Tinder Swipe Animation in Flutter
11 min readSep 29, 2020
So, Stumbling upon animation in flutter, i wanted to get a hold on the working of it.
I implemented and learnt swipe feature which includes -
- Swipe by button press
- Swipe by gesture detection
Lets get started, for the first part, swipe by gesture detection
Steps -
- Add a container or a card. Basically the widget u want to swipe
- Wrap with gesture detector
- Set alignment of widget according to onDragUpdate details
- When drag is finished , start animation
Lets begin with the first step
Step 1. Create your swipe widget
I have made a simple widget with a container wrapping my image widget
class MyCard extends StatelessWidget {
const MyCard({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: new Border.all(
width: 5.0,
color: Colors.grey.withOpacity(0.2),
),
borderRadius: BorderRadius.circular(20)),
height: MediaQuery.of(context).size.width * 0.9,
width: MediaQuery.of(context).size.width * 0.9,
child…