SliverContainer class

A sliver container that gives its sliver a foreground or background consisting of box widgets, this is useful if you want a sliver to look and feel like the child of a regular widget.

The foreground and background widgets are positioned out so that they cover the visible space of sliver, it also applies clipper with these dimensions.

bufferExtent is the amount of space the foreground and background will extend off-screen in each direction if portions of sliver are out of view. To maintain consistent decorations, this should be greater or equal to the size of any features drawn at the border.

The total main axis size of box widgets will never be smaller than bufferExtent * 2 or the main axis size of sliver, whichever is lowest.

See also:

Inheritance

Constructors

SliverContainer({Key? key, required Widget? sliver, Widget? foreground, Widget? background, double bufferExtent = 0.0, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, CustomClipper<Path>? clipper, Clip clipBehavior = Clip.antiAlias, bool clipSliverOnly = false, BorderRadiusGeometry? borderRadius})
Constructs a SliverContainer with the specified arguments.

Properties

background Widget?
The child box widget that is laid out so that it covers the visual space of sliver, and painted below it.
final
bufferExtent double
The amount of space foreground and background will extend off-screen in each direction if portions of sliver are out of view.
final
clipBehavior Clip
The clip behavior of clipper, defaults to none.
final
clipper CustomClipper<Path>?
A custom clipper that defines the path to clip sliver, foreground, and [background.
final
clipSliverOnly bool
Whether or not to ignore clipping on foreground and background.
final
foreground Widget?
The child box widget that is laid out so that it covers the visual space of sliver, and painted above it.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsetsGeometry?
How much padding to apply to the container itself.
final
padding EdgeInsetsGeometry?
How much padding to apply to sliver.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sliver Widget?
The child sliver that this container will wrap.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
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
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}) 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