SuperListView class
This is a drop-in replacement Flutter ListView that provides much better performance with large number of children with variable extents. Unlike ListView the performance does not depend on the number of children and the list can easily handle tens or hundreds of thousands of children without having to specify hardcoded extent or prototype child.
On top of performance improvements, SuperListView also has the ability to jump / animate to a specific item in the list.
See the ListView documentation for more details on how to use it.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ScrollView
- BoxScrollView
- SuperListView
- Available extensions
Constructors
-
SuperListView({Key? key, 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, double? cacheExtent, List<
Widget> children = const <Widget>[], int? semanticChildCount, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior, String? restorationId, Clip clipBehavior = Clip.hardEdge, ListController? listController, ExtentEstimationProvider? extentEstimation, ExtentPrecalculationPolicy? extentPrecalculationPolicy, bool delayPopulatingCacheArea = false}) - SuperListView.builder({Key? key, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollController? controller, bool? primary, ScrollPhysics? physics, bool shrinkWrap = false, EdgeInsetsGeometry? padding, required NullableIndexedWidgetBuilder itemBuilder, ChildIndexGetter? findChildIndexCallback, int? itemCount, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, bool addSemanticIndexes = true, double? cacheExtent, int? semanticChildCount, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior, String? restorationId, Clip clipBehavior = Clip.hardEdge, ListController? listController, ExtentEstimationProvider? extentEstimation, ExtentPrecalculationPolicy? extentPrecalculationPolicy, bool delayPopulatingCacheArea = false})
- Creates a new SuperListView that builds its children dynamically.
- SuperListView.custom({Key? key, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollController? controller, bool? primary, ScrollPhysics? physics, bool shrinkWrap = false, EdgeInsetsGeometry? padding, required SliverChildDelegate childrenDelegate, double? cacheExtent, int? semanticChildCount, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior, String? restorationId, Clip clipBehavior = Clip.hardEdge, ListController? listController, ExtentEstimationProvider? extentEstimation, ExtentPrecalculationPolicy? extentPrecalculationPolicy, bool delayPopulatingCacheArea = false})
-
Creates SuperListView with a custom child model.
const
- SuperListView.separated({Key? key, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollController? controller, bool? primary, ScrollPhysics? physics, bool shrinkWrap = false, EdgeInsetsGeometry? padding, required NullableIndexedWidgetBuilder itemBuilder, ChildIndexGetter? findChildIndexCallback, required IndexedWidgetBuilder separatorBuilder, required int itemCount, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, bool addSemanticIndexes = true, double? cacheExtent, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior, String? restorationId, Clip clipBehavior = Clip.hardEdge, ListController? listController, ExtentEstimationProvider? extentEstimation, ExtentPrecalculationPolicy? extentPrecalculationPolicy, bool delayPopulatingCacheArea = false})
- Creates a SuperListView with "items" separated by list item "separators".
Properties
- anchor → double
-
The relative position of the zero scroll offset.
finalinherited
- cacheExtent → double?
-
Deprecated. Use scrollCacheExtent instead.
finalinherited
- center → Key?
-
The first child in the GrowthDirection.forward growth direction.
finalinherited
- childrenDelegate → SliverChildDelegate
-
A delegate that provides the children for the ListView.
final
- clipBehavior → Clip
-
The content will be clipped (or not) according to this option.
finalinherited
- controller → ScrollController?
-
An object that can be used to control the position to which this scroll
view is scrolled.
finalinherited
- delayPopulatingCacheArea → bool
-
Whether the items in cache area should be built delayed.
This is an optimization that kicks in during fast scrolling, when
all items are being replaced on every frame.
With delayPopulatingCacheArea set to
true, the items in cache area are only built after the scrolling slows down.final - dragStartBehavior → DragStartBehavior
-
Determines the way that drag start behavior is handled.
finalinherited
- elHorizontalScroll → Widget
-
Available on Widget, provided by the ElWidgetExt extension
监听鼠标水平滚动(仅限桌面端生效),其后代滚动小部件必须在 widget 层指定 ScrollControllerno setter - extentEstimation → ExtentEstimationProvider?
-
Optional method that can be used to override default estimated extent for
each item. Initially all extents are estimated and then as the items are laid
out, either through scrolling or extentPrecalculationPolicy, the actual
extents are calculated and the scroll offset is adjusted to account for
the difference between estimated and actual extents.
final
- extentPrecalculationPolicy → ExtentPrecalculationPolicy?
-
Optional policy that can be used to asynchronously precalculate the extents
of the items in the list. This can be useful allow precise scrolling on small
lists where the difference between estimated and actual extents may be noticeable
when interacting with the scrollbar. For larger lists precalculating extent
has diminishing benefits since the error for each item does not impact the
overall scroll position as much.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hitTestBehavior → HitTestBehavior
-
Defines the behavior of gesture detector used in this Scrollable.
finalinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardDismissBehavior → ScrollViewKeyboardDismissBehavior?
-
The ScrollViewKeyboardDismissBehavior defines how this ScrollView will
dismiss the keyboard automatically.
finalinherited
- listController → ListController?
-
When set provides access to extents of individual children.
ListController can also be used to jump to a specific item in the list.
final
- padding → EdgeInsetsGeometry?
-
The amount of space by which to inset the children.
finalinherited
- paintOrder → SliverPaintOrder
-
The order in which to paint the slivers;
equivalently, the order in which to arrange them in the z-direction.
finalinherited
- physics → ScrollPhysics?
-
How the scroll view should respond to user input.
finalinherited
- primary → bool?
-
Whether this is the primary scroll view associated with the parent
PrimaryScrollController.
finalinherited
- restorationId → String?
-
Restoration ID to save and restore the scroll offset of the scrollable.
finalinherited
- reverse → bool
-
Whether the scroll view scrolls in the reading direction.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollBehavior → ScrollBehavior?
-
A ScrollBehavior that will be applied to this widget individually.
finalinherited
- scrollCacheExtent → ScrollCacheExtent?
-
The viewport has an area before and after the visible area to cache items
that are about to become visible when the user scrolls.
finalinherited
- scrollDirection → Axis
-
The Axis along which the scroll view's offset increases.
finalinherited
- semanticChildCount → int?
-
The number of children that will contribute semantic information.
finalinherited
- shrinkWrap → bool
-
Whether the extent of the scroll view in the scrollDirection should be
determined by the contents being viewed.
finalinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
buildChildLayout(
BuildContext context) → Widget -
Subclasses should override this method to build the layout model.
override
-
buildSlivers(
BuildContext context) → List< Widget> -
Build the list of widgets to place inside the viewport.
inherited
-
buildViewport(
BuildContext context, ViewportOffset offset, AxisDirection axisDirection, List< Widget> slivers) → Widget -
Build the viewport.
inherited
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
elScrollbarBehavior(
BuildContext context, ElScrollBehavior behavior) → Widget -
Available on Widget, provided by the ElWidgetExt extension
合并祖先 ElScrollBehavior 的默认配置,如果不需要尊重祖先配置, 请直接使用 ScrollConfiguration 覆盖即可 -
getDirection(
BuildContext context) → AxisDirection -
Returns the AxisDirection in which the scroll view scrolls.
inherited
-
noScrollbarBehavior(
BuildContext context, {Key? key, bool? overscroll, Set< PointerDeviceKind> ? dragDevices, MultitouchDragStrategy? multitouchDragStrategy, Set<LogicalKeyboardKey> ? pointerAxisModifiers, ScrollPhysics? physics, TargetPlatform? platform, ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior, bool enabled = true}) → Widget -
Available on Widget, provided by the ElWidgetExt extension
不使用祖先提供的默认滚动条,当使用自定义滚动条时请设置此扩展,可以防止与祖先提供的默认滚动条重叠 -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited