FlutterListViewDelegate class
Constructors
-
FlutterListViewDelegate(NullableIndexedWidgetBuilder builder, {int? childCount, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, bool addSemanticIndexes = true, SemanticIndexCallback semanticIndexCallback = _kDefaultSemanticIndexCallback, int semanticIndexOffset = 0, FlutterListViewDelegateOnItemKey? onItemKey, bool keepPosition = false, double keepPositionOffset = 0, FlutterListViewDelegateOnItemSticky? onItemSticky, bool stickyAtTailer = false, FlutterListViewDelegateOnItemHeight? onItemHeight, double preferItemHeight = 50, FirstItemAlign firstItemAlign = FirstItemAlign.start, int initIndex = 0, int? forceToExecuteInitIndex, double initOffset = 0.0, bool initOffsetBasedOnBottom = false, bool onIsPermanent(String keyOrIndex)?, bool isSupressElementGenerate = false, bool disableCacheItems = false, bool expandDirectToDownWhenFirstItemAlignToEnd = false})
-
Creates a delegate that supplies children for slivers using the given
builder callback.
const
Properties
-
addAutomaticKeepAlives
→ bool
-
Whether to wrap each child in an AutomaticKeepAlive.
final
-
addRepaintBoundaries
→ bool
-
Whether to wrap each child in a RepaintBoundary.
final
-
addSemanticIndexes
→ bool
-
Whether to wrap each child in an IndexedSemantics.
final
-
builder
→ NullableIndexedWidgetBuilder
-
Called to build children for the sliver.
final
-
childCount
→ int?
-
The total number of children this delegate can provide.
final
-
disableCacheItems
→ bool
-
syncCreatedItemIndexs
is used to create item when list view created
indexs which need create
The method will be invoke to create element when childCount from 0 to non-zero
or childCount is non-zero when list view mounted
or syncCreatedItemIndexs changed
Notice, it will be trigger when syncCreatedItemKeyOrIndexs object mutated
It will rememeber the keyOrIndex once created
Disable cache deactive item when item is invisble
final
-
estimatedChildCount
→ int?
-
Returns an estimate of the number of children this delegate will build.
no setteroverride
-
expandDirectToDownWhenFirstItemAlignToEnd
→ bool
-
expandDirectToDownWhenFirstItemAlignToEnd is true, the item which in viewpoint expand. when first item align to end. the expand direct is to down.
final
-
firstItemAlign
→ FirstItemAlign
-
When item is not enough fill one viewport. Where is the items shoule align to
For example: if reverse is false,
When firstItemAlign=FirstItemAlign.start, the item should located on top.
When firstItemAlign=FirstItemAlign.end, the item should located on bottom.
final
-
forceToExecuteInitIndex
→ int?
-
final
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
initIndex
→ int
-
When childCount from 0 to non-zore, the initIndex will effect,
When initIndex changed, if child count is not 0, it also effect
initOffset is scroll to index and the distance from top or bottom based
on initOffsetBasedOnBottom
If your initIndex didn't change. but data have changed, if you want force wiget to jump to initIndex,
You can change forceToExecuteInitIndex, widget will detct does the forceToExecuteInitIndex have be changed.
Once it changed, It also enforce to execute jump to initIndex.
final
-
initOffset
→ double
-
final
-
initOffsetBasedOnBottom
→ bool
-
final
-
isSupressElementGenerate
→ bool
-
isSupressElementGenerate is true, the element will not generated during scroll
final
-
keepPosition
→ bool
-
Whem keepPosition is false, If some item insert to header, the render items will scroll down a distance
which is equal the inserted items' height, When the property set to true, The current render item will
keep same position. Notice: it the keepPosition set to true, onItemKey must not be null and each item's must
unique.
When keepPosition is true and scrolloffset>=keepPositionOffset, the keep position will enable
final
-
keepPositionOffset
→ double
-
final
-
onIsPermanent
→ (bool Function(String keyOrIndex)?)
-
Query does the item is permanent item
permanent item will not reused and release util list view disposed
keyOrIndex
is onItemKey provide, the param is key, else it is index
final
-
onItemHeight
→ FlutterListViewDelegateOnItemHeight?
-
If you know the item height, it is better provider the height
It can provide better user expierence
final
-
onItemKey
→ FlutterListViewDelegateOnItemKey?
-
onItemKey will indicate the item key
The key will used to ref the item's height
If you enable keepPosition, the key will be used to identify inserted items
which is before the current rendered key
final
-
onItemSticky
→ FlutterListViewDelegateOnItemSticky?
-
Query the item is sticky to header.
stickyAtTailer is mean sticky from bottom to top, in normal sticky item will show on top, but if it is true, it mean the sticky will show on bottom
final
-
preferItemHeight
→ double
-
If you didn't provide onItemHeight, the preferItemHeight will be apply to item which is not render.
final
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
semanticIndexCallback
→ SemanticIndexCallback
-
A SemanticIndexCallback which is used when addSemanticIndexes is true.
final
-
semanticIndexOffset
→ int
-
An initial offset to add to the semantic indexes generated by this widget.
final
-
stickyAtTailer
→ bool
-
final