Skip to main content

ListView

The ListView widget is a scrollable list that lays items out along a single axis — vertical by default.
It draws one item for every entry in your data, so use it for screens where items run continuously, such as lists, feeds, and search results.

Definition and role

The ListView widget places child items in order along the axis you choose, and lets you keep scrolling once the content runs past the visible area. The number of repeated items grows and shrinks with the data you bind, and you can set the spacing between items, the padding inside the list, the scroll direction, the scroll physics, and more. It also covers infinite scroll — catch the event that fires when scrolling reaches the end, then load the next batch of data.

  • Category: Layouts
  • Default scroll direction: vertical
  • Default item count: 0

Features

FeatureDescription
Repeated item renderingDraws one child item for every entry in the bound data (itemCount).
Scroll directionLays items out and scrolls them vertically (vertical) or horizontally (horizontal).
Item spacingAdds even spacing between items with the spacing value.
End-of-scroll detectionWhen scrolling reaches the end of the list, onScrollEnd fires — use it to load more items (infinite scroll).
Overflow clippingSet overflowMode to clip to crop items to the area you defined and report how many were cut.
Entrance animationUse the animation setting to give items a staggered entrance effect.

How to use

  1. Open the Layouts category in the left widget palette.
  2. Drag and drop the ListView item onto the canvas.
  3. Place the child widgets you want to repeat inside the list.
  4. In the Properties panel on the right, bind itemCount to your data or set a fixed count.
  5. Adjust the scroll direction (scrollDirection), item spacing (spacing), and padding (padding) as needed.

Properties

PropertyDescriptionDefaultValues / type
scrollDirectionDirection items are laid out and scrolled inverticalhorizontal, vertical
reverseDisplays items in reverse orderOff (false)true / false
shrinkWrapShrinks the list to fit its contentOn (true)true / false
spacingSpacing between itemsNot setNumber
paddingPadding inside the listNot setPadding
controllerController that drives scrollingNot setScroll controller
primaryWhether to use this as the screen's primary scroll viewNot settrue / false
physicsScroll physicsNot setbouncing, clamping, alwaysScrollable, rangeMaintaining, neverScrollable, page
itemExtentFixed size of each item along the main axisNot setNumber
addAutomaticKeepAlivesKeeps the state of off-screen items alive automaticallyOn (true)true / false
addRepaintBoundariesAdds a repaint boundary around each itemOn (true)true / false
addSemanticIndexesAssigns accessibility indexes to items automaticallyOn (true)true / false
cacheExtentSize of the area built ahead of time off-screenNot setNumber
semanticChildCountNumber of items reported to accessibilityNot setInteger
itemCountNumber of items to draw repeatedly (supports data binding)0Integer
dragStartBehaviorWhen a drag-to-scroll gesture startsstartstart, down
keyboardDismissBehaviorHow the keyboard is dismissed while scrollingmanualmanual, onDrag
restorationIdIdentifier used to restore the scroll positionNot setString
clipBehaviorHow content outside the area is clippedhardEdgenone, hardEdge, antiAlias, antiAliasWithSaveLayer
animationStaggered entrance animation settings for itemsNot setAnimation settings
overflowModeHow items that overflow the area are handlednonenone, clip
reservedTrailingExtentExtra width to leave empty out of the available width in clip modeNot setNumber

Notes and tips

tip

onScrollEnd fires once when scrolling reaches the end of the list, and arms itself again as soon as you scroll away from the end. Use it for infinite scroll that loads the next page.

warning

scrollToIndex and getFirstVisibleIndex only work when itemExtent — the fixed item size — is set. Without a value, scrolling to an index does nothing and the first visible index returns 0.

Learn more

tip

For the full set of Widget Control members (Property, Method, and Event) that drive this widget from a script, see ListView Widget Control.