A viewport on an infinite list of variable height children.
LazyBlockViewport is a a general-purpose viewport for a large (or infinite) number of children that might not all have the same height. Rather than materializing all of its children, LazyBlockViewport asks its delegate to build child widgets lazily to fill itself. LazyBlockViewport caches the widgets it obtains from the delegate as long as they're visible. (See LazyBlockDelegate.shouldRebuild for details about how to evict the cache.)
LazyBlockViewport works by dead reckoning changes to its startOffset from the top of the first child that is visible in itself. For this reason, making large changes to the startOffset is expensive because LazyBlockViewport computes the size of every child between the old offset and the new offset.
Prefer ListViewport when all the children have the same height because it can use that property to be more efficient. Prefer Viewport when there is only one child.
For a scrollable version of this widget, see LazyBlock.
- Inheritance
- Object
- Widget
- RenderObjectWidget
- LazyBlockViewport
Constructors
- LazyBlockViewport({Key key, @required LazyBlockDelegate delegate, double startOffset: 0.0, Axis mainAxis: Axis.vertical, EdgeInsets padding, LazyBlockExtentsChangedCallback onExtentsChanged })
-
Creates a viewport on an infinite list of variable height children.
Properties
- delegate → LazyBlockDelegate
-
Provides children for this widget.
read-only - mainAxis → Axis
-
The direction in which the children are permitted to be larger than the viewport.
read-only - onExtentsChanged → LazyBlockExtentsChangedCallback
-
Called when the interior or exterior dimensions of the viewport change.
read-only - padding → EdgeInsets
-
The amount of space by which to inset the children inside the viewport.
read-only - startOffset → double
-
The offset of the start of the viewport.
read-only - hashCode → int
-
Get a hash code for this object.
read-only, inherited - key → Key
-
Controls how one widget replaces another widget in the tree.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
createElement(
) → _LazyBlockElement -
RenderObjectWidgets always inflate to a
RenderObjectElement
subclass. -
createRenderObject(
BuildContext context) → _RenderLazyBlock -
Creates an instance of the
RenderObject
class that thisRenderObjectWidget
represents, using the configuration described by thisRenderObjectWidget
. -
debugFillDescription(
List<String> description) → void -
Add additional information to the given description for use by toString.
inherited -
didUnmountRenderObject(
RenderObject renderObject) → void -
A render object previously associated with this widget has been removed from the tree. The given RenderObject will be of the same type as returned by this object's createRenderObject.
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
toStringShort(
) → String -
A short, textual description of this widget.
inherited -
updateRenderObject(
BuildContext context, RenderObject renderObject) → void -
Copies the configuration described by this RenderObjectWidget to the given RenderObject, which will be of the same type as returned by this object's createRenderObject.
inherited