Home > Enterprise >  How to access "index" propery in Flutter Widget: minhhung2556 / romantic_project_flutter_h
How to access "index" propery in Flutter Widget: minhhung2556 / romantic_project_flutter_h

Time:12-30

I'm new to Flutter / Dart so sorry if this is a dumb question. I'm trying the "flutter_horizontal_featured_list" widget but don't know how to access item index inside onPressedItem? As this method is outside itemBuilder I can't seem to access the index property...

Found no documentation here: https://github.com/minhhung2556/romantic_project_flutter_horizontal_featured_list

Thanks!

CodePudding user response:

You can use InkWell or GestureDetector() as a return Widget of the builder the add the function inside the you can get Widget index.

CodePudding user response:

Use Listview.builder which has a context and index.

for tap you can use inkWell or GestureDetector

Here is the example for listview.builder

  • Related