Home > Software design >  Flutter list view navigation to categories
Flutter list view navigation to categories

Time:10-10

I'm learning Flutter. I have a ListView and I would like to make the list items clickable. My idea is that when the user clicks on an item, it will be directed to another screen. Each buttom should leads to different screen. I'm having trouble implementing it, I don't know what to use: gesture detector or ontap. What should I do? Should I use ListTile instead of ListView?list viewdata

CodePudding user response:

If you're using a ListView.builder, you can use a ListTile to add an onTap.

ListView.builder(
  itemBuilder: (_, i) {
    return ListTile(
      title: Text('$i'),
      onTap: () {}, // Handle your onTap here. 
    );
  },
)

CodePudding user response:

well, you can use Inkwell. ListView.builder( itemBuilder: (_, i) { return InkWell( onTap: (){}, child: ///widget, ); }, ) link enter link description here

  • Related