XlbAnimated constructor

const XlbAnimated(
  1. {@required LiveListItemBuilder itemBuilder,
  2. @required int itemCount,
  3. IndexedWidgetBuilder separatorBuilder,
  4. double visibleFraction = 0.025,
  5. bool reAnimateOnVisibility = false,
  6. Duration delay = Duration.zero,
  7. Duration showItemInterval = _kDuration,
  8. Duration showItemDuration = _kDuration,
  9. Axis scrollDirection = Axis.vertical,
  10. bool reverse = false,
  11. ScrollController controller,
  12. bool primary,
  13. ScrollPhysics physics,
  14. bool shrinkWrap = false,
  15. EdgeInsetsGeometry padding,
  16. bool addAutomaticKeepAlives = true,
  17. bool addRepaintBoundaries = true,
  18. bool addSemanticIndexes = true,
  19. Key key}
)

Creates a fixed-length scrollable linear array of list "items" separated by list item "separators".

This constructor is appropriate for list views with a large number of item and separator children because the builders are only called for the children that are actually visible.

The itemBuilder callback will be called with indices greater than or equal to zero and less than itemCount.

Separators only appear between list items: separator 0 appears after item 0 and the last separator appears before the last item.

The separatorBuilder callback will be called with indices greater than or equal to zero and less than itemCount - 1. May be null

The itemBuilder and separatorBuilder callbacks should actually create widget instances when called. Avoid using a builder that returns a previously-constructed widget; if the list view's children are created in advance, or all at once when the XlbAnimated itself is created, it is more efficient to use new XlbAnimated.

{@tool sample}

This example

XlbAnimated(
  itemCount: 25,
  separatorBuilder: (BuildContext context, int index) => Divider(),
  itemBuilder: (_ context, int index, Animation<double> animation) {
    return ListTile(
      title: Text('item $index'),
    );
  },
)

{@end-tool}

The addAutomaticKeepAlives argument corresponds to the SliverChildBuilderDelegate.addAutomaticKeepAlives property. The addRepaintBoundaries argument corresponds to the SliverChildBuilderDelegate.addRepaintBoundaries property. The addSemanticIndexes argument corresponds to the SliverChildBuilderDelegate.addSemanticIndexes property. None may be null.

Implementation

const XlbAnimated({
  @required this.itemBuilder,
  @required this.itemCount,
  this.separatorBuilder,
  this.visibleFraction = 0.025,
  this.reAnimateOnVisibility = false,
  this.delay = Duration.zero,
  this.showItemInterval = _kDuration,
  this.showItemDuration = _kDuration,
  this.scrollDirection = Axis.vertical,
  this.reverse = false,
  this.controller,
  this.primary,
  this.physics,
  this.shrinkWrap = false,
  this.padding,
  this.addAutomaticKeepAlives = true,
  this.addRepaintBoundaries = true,
  this.addSemanticIndexes = true,
  Key key,
})  : assert(itemBuilder != null),
      assert(itemCount != null && itemCount >= 0),
      super(key: key);