Posts

Showing posts with the label LikeButton

Like Button Sample Project

Image
Today I am going to build a Like button using flutter and fire-store. Actually this is not a button. It displays how to code for "Like Button" . Here I am using authenticate users and their user id. Here is the Sample Code for this project. class PublishPost extends StatefulWidget{    @override    _PublishPost createState() => new _PublishPost(); } class _PublishPost extends State<PublishPost> {   bool isPostLiked = false ;      @override      Widget _buildListItem (BuildContext context, DocumentSnapshot document) {       List<String> users;       Widget child;        if (document[ 'likedby' ].contains( '4' )) {         child = Text( 'Liked' );       } else {         child = Text( 'Like' );       }      ...