fluttercandies / like_button

Like Button is a flutter library that allows you to create a button with animation effects similar to Twitter's heart when you like something and animation effects to increase like count.
MIT License
469 stars 96 forks source link

Trigger on Tap without touch the icon #58

Closed carrasc0 closed 2 years ago

carrasc0 commented 3 years ago

I would like to trigger the like event, like for example, double tapping my post like Instagram. As far as i saw, i didnt manage to make it, is there any way that I am missing out??

Thanks in advance

Aobanana-chan commented 2 years ago

You can use Globalkey to get LikeButtonState. And then use it to call onTap.

Like this:

GlobalKey<LikeButtonState> key = GlobalKey<LikeButtonState>();
LikeButton(key: key,
etc...);
key.currentState?.onTap();

Actually,I don't like to use Globalkey to do this. But I really have no way to solve this problem except edit the source code.

zmtzawqlp commented 2 years ago

You can use Globalkey to get LikeButtonState. And then use it to call onTap.

Like this:

GlobalKey<LikeButtonState> key = GlobalKey<LikeButtonState>();
LikeButton(key: key,
etc...);
key.currentState?.onTap();

Actually,I don't like to use Globalkey to do this. But I really have no way to solve this problem except edit the source code.

pr is welcome, if you have any better way to do this , thanks