Viewport constructor Null safety
- {Key? key,
- AxisDirection axisDirection = AxisDirection.down,
- AxisDirection? crossAxisDirection,
- double anchor = 0.0,
- required ViewportOffset offset,
- Key? center,
- double? cacheExtent,
- CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel,
- Clip clipBehavior = Clip.hardEdge,
- List<
Widget> slivers = const <Widget>[]}
Creates a widget that is bigger on the inside.
The viewport listens to the offset, which means you do not need to rebuild this widget when the offset changes.
The offset argument must not be null.
The cacheExtent must be specified if the cacheExtentStyle is not CacheExtentStyle.pixel.
Implementation
Viewport({
super.key,
this.axisDirection = AxisDirection.down,
this.crossAxisDirection,
this.anchor = 0.0,
required this.offset,
this.center,
this.cacheExtent,
this.cacheExtentStyle = CacheExtentStyle.pixel,
this.clipBehavior = Clip.hardEdge,
List<Widget> slivers = const <Widget>[],
}) : assert(offset != null),
assert(slivers != null),
assert(center == null || slivers.where((Widget child) => child.key == center).length == 1),
assert(cacheExtentStyle != null),
assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null),
assert(clipBehavior != null),
super(children: slivers);