ContentLayers class abstract

Widget that displays content above a number of underlays, and beneath a number of overlays.

This widget is similar in behavior to a Stack, except this widget alters the build and layout order to support use-cases where various layers depend upon the layout of a single content layer.

This widget is useful for use-cases where decorations need to be positioned relative to content within the content widget. For example, this ContentLayers might be used to display a document as content and then display text selection as an underlay, the caret as an overlay, and user comments as another overlay.

The layers are sized to be exactly the same as the content, and the layers are positioned at the same (x,y) as content.

The layers are built after content is laid out, so that the layers can inspect the content layout during the layers' build phase. This makes it easy, for example, to position a caret on top of a document, using only the widget tree.

Some of the implementation details differ between RenderBox and RenderSliver use-cases, therefore this class is abstract. Use either the box or sliver version of this widget depending on your use-case.

Inheritance
Implementers

Constructors

ContentLayers({Key? key, List<ContentLayerWidgetBuilder> underlays = const [], required Widget content(VoidCallback onBuildScheduled), List<ContentLayerWidgetBuilder> overlays = const []})
const

Properties

content Widget Function(VoidCallback onBuildScheduled)
The primary content displayed in this widget, which determines the size and location of all underlays and overlays.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
overlays List<ContentLayerWidgetBuilder>
Layers displayed above the content.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
underlays List<ContentLayerWidgetBuilder>
Layers displayed beneath the content.
final

Methods

createElement() RenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
override
createRenderObject(BuildContext context) RenderObject
Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.
override
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
didUnmountRenderObject(covariant RenderObject renderObject) → void
This method is called when a RenderObject that was previously associated with this widget is removed from the render tree. The provided RenderObject will be of the same type as the one created by this widget's createRenderObject method.
inherited
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
updateRenderObject(BuildContext context, covariant 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

Operators

operator ==(Object other) bool
The equality operator.
inherited