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?
3
Answers
Create custom text function like this
// And use this function inside list return item like this
As you are using ListViewBuilder then there can be two scenarios
First,
If you know which particular index’s text you have to make clickable then you can use a direct approach by using index
Or there can be a scenario of using data of index or from text itself same approach can be used only the condition in if has to be changed according to your usage requirement.
=>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