flutter_chat_ui icon indicating copy to clipboard operation
flutter_chat_ui copied to clipboard

Swipe to reply prototype

Open Voidozzer opened this issue 2 years ago • 11 comments

What does it do?

Adds swipe to reply prototype

Voidozzer avatar Apr 15 '22 14:04 Voidozzer

Very excited for this! Thank you!

Justus-M avatar Apr 15 '22 20:04 Justus-M

Hi @felixgabler! We are a bit stuck here and maybe you will have some ideas. We are using https://pub.dev/packages/flutter_slidable for the swipe to reply feature, but the package has one problem - it has no auto close, i.e. when we swipe to reply we want the reply icon to hide automatically, this package does not support it. I guess it was mentioned somewhere there, but it is not actively maintained. @Voidozzer wrapped slidable with Listener (see file message.dart) but it detects both vertical and horizontal swipes resulting in reply triggering while you are simply scrolling through messages (you can observe this behaviour on a branch). Maybe you can take a look with a fresh pair of 👀

demchenkoalex avatar Apr 18 '22 18:04 demchenkoalex

Hi! Sure, I will have a look tomorrow when my eyes are actually fresh again 😴 I'll need to check this PR out to see where the problem is exactly.

Until then, one quick thing I found is this package: https://pub.dev/packages/swipe_to. The code looks nice and short (I wouldn't expect this functionality to require a ton of code). It seems to have swipe detection and showing an icon if that is something we need.

Otherwise, one could fork the repository of flutter_slidable but that obviously always brings extra maintenance.

felixgabler avatar Apr 18 '22 19:04 felixgabler

Thanks! We could totally try a different dependency if needed. Fork would not help because when distributing a package you can have only pub dependencies, we would need to release a fork, which is not good IMO :)

demchenkoalex avatar Apr 18 '22 19:04 demchenkoalex

I've tried out the swipe_to package here and it definitely works better. However, it just starts an animation on the first movement instead of offering full moving control. This can also be annoying. Please try it out and let me know what you think.

One alternative could be writing a custom widget for this. If you take a look at the source code of swipe to, you'll see that it is not that hard. We can use Draggable, restrict its axis and that might also work for our purposes.

Lastly, I changed the swipe direction to reply on swipe right instead of left. This is what most people are most likely used to. Was there a particular reason why it was swipe left? Feel free to change it back then!

felixgabler avatar Apr 19 '22 09:04 felixgabler

@felixgabler swipe right on iOS usually works as a back gesture. Facebook Messenger, Telegram, Instagram all have swipe left actions, not sure why you think swipe right is what people used to :)

Regarding swipe_to I believe @Voidozzer checked that, but at the time of implementing this feature, swipe_to was unsupported for a year plus and did not work for our case, this was fairly recent update. We will try the swipe_to again and see how it looks like. Thanks!

demchenkoalex avatar Apr 19 '22 10:04 demchenkoalex

That's interesting! I checked on WhatsApp, Signal and Teams, which are my most used messengers. I guess it differs for platforms and we can also just choose the other direction. Or perhaps we can make it configurable for the end user. Not really hard with swipe_to.

felixgabler avatar Apr 19 '22 10:04 felixgabler

Yeah, should be configurable

demchenkoalex avatar Apr 19 '22 10:04 demchenkoalex

Hi @demchenkoalex! Feels like things have gone a little quiet in this repo. Hope you, your family, and friends are doing well!

Is there a rough expected timeline on the release that will include message replies? Have you decided whether to release it next, or move straight to 2.0?

Happy to help any way I can.

Justus-M avatar May 19 '22 09:05 Justus-M

I was waiting for Flutter 3 and now I have lots of stuff at work and a small vacation upcoming. So as soon as I feel like finishing I will, this requires lots of redoing, since the code is more like a draft than a finished and polished product.

demchenkoalex avatar May 19 '22 09:05 demchenkoalex

Ok understood, thanks for the quick reply!

Justus-M avatar May 19 '22 09:05 Justus-M

Closing as a duplicate. #256

demchenkoalex avatar Oct 29 '22 08:10 demchenkoalex