Create a horizontal list
Use the standard
ListView constructor, passing in a horizontal
scrollDirection, which overrides the default vertical direction.
ListView( // This next line does the trick. scrollDirection: Axis.horizontal, children: <Widget>[ Container( width: 160.0, color: Colors.red, ), Container( width: 160.0, color: Colors.blue, ), Container( width: 160.0, color: Colors.green, ), Container( width: 160.0, color: Colors.yellow, ), Container( width: 160.0, color: Colors.orange, ), ], )
In an Android ListView, you create an adapter and pass it into the ListView, which renders each row with what your adapter returns.. Due to Flutter’s immutable widget pattern, you pass a list of widgets to your ListView, and Flutter takes care of making sure that scrolling is fast and smooth.. In Android, the ListView has a method to find out which item was clicked, ‘onItemClickListener’..
have a different lifespan: they are immutable and only exist until they need to be changed. Are lightweight, in part due to their immutability. Describe what their view should look like given their current configuration and state.. When a widget’s state changes, the widget rebuilds its description, which the framework diffs against the previous description in order to determine the minimal changes needed in the underlying render tree to transition from one state to the next..