Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HeartOverlayAnimator appearing on all images/posts in list view. #7

Open
githubaamod opened this issue May 16, 2020 · 0 comments
Open

Comments

@githubaamod
Copy link

githubaamod commented May 16, 2020

Hi,

I am using this HeartOverlayAnimator in my project. Expected result is this effect must display only on image/post which user will like(double tap). When i double tap on image/post this icon is appearing on all images/posts. I already have like button implemented and only need this HeartOverlayAnimator effect when user like any post/image.

I have used HeartOverlayAnimator like below.

import 'package:cmpic/widgets/heartoverlay.dart';
final StreamController<void> _doubleTapImageEvents =
    StreamController.broadcast();

i have a function which handles like event. In that function i have written this.

 if (_isLiked) // display overlay only for Like event and not for Unlike.
_doubleTapImageEvents.sink.add(null);

below is my gesture detector for post/images.

GestureDetector(
                          onDoubleTap: () => handleLikePost(products[index]),
                          child: Stack(
                            alignment: Alignment.center,
                            children: <Widget>[
                              CachedNetworkImage(
                                width: MediaQuery.of(context).size.width - 2,
                                imageUrl: products[index].entryimgpathbig,
                                placeholder: (context, url) =>
                                    new CircularProgressIndicator(),
                                errorWidget: (context, url, error) =>
                                    new Icon(Icons.error),
                              ),

                              HeartOverlayAnimator(
                                  triggerAnimationStream:
                                      _doubleTapImageEvents.stream),
                            ],
                          ),
                        ),

is there anything i am missing or implementing wrong? Please let me know how to display this effect on only images/post which user has doubletapped/liked.

thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant