You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we add a feature to accept an optional index on the like button it helps when we want to do a request that required to get the item liked i.e in this case with an index. because onTap: Future<bool?> Function(bool)? onTap function is very limited i will be happy to contribute.
Why
child: RecommendedCard(
width: getScreenWidth(context) / 2.5,
height: getScreenWidth(context) / 2.5,
image: '$imageBaseUrl/${event.image}',
tagText: event.category?.name ?? '',
titleText: event.title ?? '',
dateText: event.date ?? '',
onLike: () async {
await notifier.like(event.id ?? 0, index);
},
isFavourite: event.isliked ?? 0,
//onLikeButtonTapped does a request and it needs and index button like button only accept this function type[ Future<bool?> Function(bool)? onTap ]
onTap: notifier.onLikeButtonTapped,
),
);
},
),
//This is my controller with notifier.onLikeButtonTapped method
//This is the function accepted by LikeButton , so its limited i can get an object tapped so that i can do a proper request
Future<bool> onLikeButtonTapped(bool isLiked) async {
int likeStatus = 0;
setLikingStatus(true);
state = state.copyWith(likeEventResult: const AsyncValue.loading());
final result = await _recommendedEventsServiceImpl.like(
LikeRequest(
eventId: state.eventId,
userId: int.parse(_preferencesNotifier.getUserID()),
),
);
The text was updated successfully, but these errors were encountered:
I think you don't need do as that. A custom widget include your item data and LikeButton will work.
Oww yes yes thank you for your timely response, I think I have logged this as a feature request and not issue. I have it working already but its just a suggestion to enhance LikeButton.
Platforms
dart
Description
Can we add a feature to accept an optional index on the like button it helps when we want to do a request that required to get the item liked i.e in this case with an index. because onTap: Future<bool?> Function(bool)? onTap function is very limited i will be happy to contribute.
Why
The text was updated successfully, but these errors were encountered: