Swiping like an arc with controller
Opened this issue · 2 comments
Hi @ricardodalarme, I've recently added a PR #46 which contains the implementation for swiping to any given angle with the controller where as of now controller can only swipe the card to the predefined left
, right
, top
, bottom
directions.
#46 brings the ability to swipe to any given angle with the CardSwiperDirection.custom
constructor to specify angle at which the card should be swiped.
But, along the way while I was implementing it, I had this idea in mind - generally humans swipe items on the screen like an arc or something - why can't we have that? Right now, even the swiping to custom angle basically moves the container in a linear path.
Can we add the CardSwiperController.swipeArc
for this? Or do I sound way too stupid? :)
By the way, just taking a moment to thank you for this library! Truly makes lives easy - I should say best pick for card swiping packages out there in pub.dev.
Also, just want to let you know that, if this sounds good, I'll be happy to raise another PR for this. :)
In fact, I've tried implementing this in my fork here: HeySreelal/flutter_card_swiper/feat-arc-swipe.
Let me add couple of screen recording to illustrate this.
Screen Recordings
1. Normal Behavior
Code:
FloatingActionButton(
onPressed: () {
const dir = CardSwiperDirection.left;
controller.swipe(dir);
},
child: const Icon(Icons.keyboard_arrow_left),
),
FloatingActionButton(
onPressed: () {
const dir = CardSwiperDirection.right;
controller.swipe(dir);
},
child: const Icon(Icons.keyboard_arrow_right),
),
Screen.Recording.2024-10-06.at.1.20.52.PM.mov
2. Swiping to custom angle
Code:
FloatingActionButton(
onPressed: () {
final dir = CardSwiperDirection.custom(290);
controller.swipe(dir);
},
child: const Icon(Icons.keyboard_arrow_left),
),
FloatingActionButton(
onPressed: () {
final dir = CardSwiperDirection.custom(60);
controller.swipe(dir);
},
child: const Icon(Icons.keyboard_arrow_right),
),
Screen.Recording.2024-10-06.at.1.21.26.PM.mov
3. Swiping to custom angle as arc
Code:
FloatingActionButton(
onPressed: () {
final dir = CardSwiperDirection.custom(290);
controller.swipeArc(
dir,
curve: Curves.easeInOut,
);
},
child: const Icon(Icons.undo),
),
FloatingActionButton(
onPressed: () {
final dir = CardSwiperDirection.custom(60);
controller.swipeArc(
dir,
curve: Curves.easeInOut,
);
},
child: const Icon(Icons.redo),
),
Screen.Recording.2024-10-06.at.1.21.03.PM.mov
That's it, hoping this would be a cool addition :)
Looking forward to hearing from you, thanks :)
guys is this implemented ? i cannot find custom in the enums im at 7.0.2