Add this two lines
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
...
In this code snippet, have a ListView.builder with the following properties:
scrollDirection: Axis.vertical: This property specifies the scrolling direction of the list. In this case, it is set to Axis.vertical, which means the list will scroll vertically. You can also set it to Axis.horizontal if you want the list to scroll horizontally.
shrinkWrap: true: By default, a ListView takes up as much space as it can along its main axis. However, when you set shrinkWrap to true, the ListView will try to wrap its content and only take up as much space as needed. This can be helpful when you want to include a ListView inside another scrollable view or when the size of the list is not predetermined.
Comments
Post a Comment