geometry property
The amount of space this sliver occupies.
This value is stale whenever this object is marked as needing layout. During performLayout, do not read the geometry of a child unless you pass true for parentUsesSize when calling the child's layout function.
The geometry of a sliver should be set only during the sliver's performLayout or performResize functions. If you wish to change the geometry of a sliver outside of those functions, call markNeedsLayout instead to schedule a layout of the sliver.
Implementation
SliverGeometry? get geometry => _geometry;
Implementation
set geometry(SliverGeometry? value) {
assert(!(debugDoingThisResize && debugDoingThisLayout));
assert(sizedByParent || !debugDoingThisResize);
assert(() {
if ((sizedByParent && debugDoingThisResize) ||
(!sizedByParent && debugDoingThisLayout)) {
return true;
}
assert(!debugDoingThisResize);
DiagnosticsNode? contract, violation, hint;
if (debugDoingThisLayout) {
assert(sizedByParent);
violation = ErrorDescription('It appears that the geometry setter was called from performLayout().');
} else {
violation = ErrorDescription('The geometry setter was called from outside layout (neither performResize() nor performLayout() were being run for this object).');
if (owner != null && owner!.debugDoingLayout) {
hint = ErrorDescription('Only the object itself can set its geometry. It is a contract violation for other objects to set it.');
}
}
if (sizedByParent) {
contract = ErrorDescription('Because this RenderSliver has sizedByParent set to true, it must set its geometry in performResize().');
} else {
contract = ErrorDescription('Because this RenderSliver has sizedByParent set to false, it must set its geometry in performLayout().');
}
final List<DiagnosticsNode> information = <DiagnosticsNode>[
ErrorSummary('RenderSliver geometry setter called incorrectly.'),
violation,
if (hint != null) hint,
contract,
describeForError('The RenderSliver in question is'),
];
throw FlutterError.fromParts(information);
}());
_geometry = value;
}