Posts

Showing posts with the label Firebase

Add Comment Sample Project

Image
Hi everyone, Today I am going to develop simple " Add Comment " project. I use following code to show comment icon. IconButton comment = IconButton( iconSize: 35.0 , icon: Icon(Icons. chat_bubble_outline ,color: Colors. grey ), onPressed: ()=> _commentButtonPressed(), );   return ListTile( leading: comment, ) class CommentScreen extends StatefulWidget { final String postId ; const CommentScreen(document, this . postId ); @override _CommentScreenState createState() => _CommentScreenState( postId: this . postId , ); } class _CommentScreenState extends State<CommentScreen> { final String postId ; final TextEditingController _commentController = TextEditingController(); _CommentScreenState({ this . postId }); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( "Comments" , style: TextStyle(color: Colors. black )...

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' );       }      ...