XlbAnimated constructor
- {@required LiveListItemBuilder itemBuilder,
- @required int itemCount,
- IndexedWidgetBuilder separatorBuilder,
- double visibleFraction = 0.025,
- bool reAnimateOnVisibility = false,
- Duration delay = Duration.zero,
- Duration showItemInterval = _kDuration,
- Duration showItemDuration = _kDuration,
- Axis scrollDirection = Axis.vertical,
- bool reverse = false,
- ScrollController controller,
- bool primary,
- ScrollPhysics physics,
- bool shrinkWrap = false,
- EdgeInsetsGeometry padding,
- bool addAutomaticKeepAlives = true,
- bool addRepaintBoundaries = true,
- bool addSemanticIndexes = true,
- 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);