Tomee
Tomee

Reputation: 139

Is it possible to use onTap with FirebaseAnimatedList

i'm pretty new in Flutter. So i wanted to ask you guys, is it possible using FirebaseAnimatedList to make it pop another window when user presses the list item. I have a feeling that it not be possible to do it, would be great if someone could explain it.

 child: FirebaseAnimatedList(
    query: dbRef,
    itemBuilder: (BuildContext context, DataSnapshot snapshot,
        Animation<double> animation, int index) {
      Map contact = snapshot.value;
      return _buildContactItem(contact: contact);
    },
  ),

Instance of onTap code snippet

  onTap: () {
    Navigator.push(
      context,
      MaterialPageRoute(builder: (context) => ItemPage(uid: widget.uid)),
    );
  }, 
)

Upvotes: 1

Views: 223

Answers (1)

BosS
BosS

Reputation: 501

If I understand u well, u want to make onPress method for each listItem?

just wrap your widget with Inkwell inside your itembuilder.

For example:

   _buildContactItem(Contact contact){
   return InkWell(
    onTap: () {
    Navigator.push(
    context,
     MaterialPageRoute(builder: (context) => ItemPage(uid: widget.uid)),
     );
    },

    child: yourChildWidgetsHere
   }

Try this, I hope it will help you!

Upvotes: 2

Related Questions