-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels