XlbAnimated.options constructor
- {@required LiveListItemBuilder itemBuilder,
- @required int itemCount,
- @required LiveOptions options,
- IndexedWidgetBuilder separatorBuilder,
- 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.options(
itemCount: 25,
option: LiveOptions(
// Start animation after (default zero)
delay: Duration(seconds: 1),
// Show each item through
showItemInterval: Duration(milliseconds: 500),
// Animation duration
showItemDuration: Duration(seconds: 1),
// Animations starts at 0.025 visible item fraction in sight
visibleFraction: 0.025,
),
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
XlbAnimated.options({
@required this.itemBuilder,
@required this.itemCount,
@required LiveOptions options,
this.separatorBuilder,
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,
}) : delay = options.delay,
showItemInterval = options.showItemInterval,
showItemDuration = options.showItemDuration,
visibleFraction = options.visibleFraction,
reAnimateOnVisibility = options.reAnimateOnVisibility,
assert(itemBuilder != null),
assert(itemCount != null && itemCount >= 0),
super(key: key);