I am getting a list of responses from API, and I am using List View Builder and a text widget to display them all at once, so now I will have multiple texts according to the length of the response. How do I make just one particular text have the on-click property so that when I click that one particular text, I can navigate to another page?
=>You can use an index directly if there is particular index text you need to make clickable After that you can pass data in Navigation
ListView.builder(
physics: const AlwaysScrollableScrollPhysics(),
itemCount: UserList.length,
shrinkWrap: true,
itemBuilder: (context, index){
return InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SecondScreen(user: UserList[index].name),
),
);
},
child: Text(UserList[index].name),
);
});