geometry property

SliverGeometry geometry

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.


SliverGeometry get geometry => _geometry;
void geometry= (SliverGeometry value)


set geometry(SliverGeometry value) {
  assert(!(debugDoingThisResize && debugDoingThisLayout));
  assert(sizedByParent || !debugDoingThisResize);
  assert(() {
    if ((sizedByParent && debugDoingThisResize) ||
        (!sizedByParent && debugDoingThisLayout))
      return true;
    String contract, violation, hint;
    if (debugDoingThisLayout) {
      violation = 'It appears that the geometry setter was called from performLayout().';
      hint = '';
    } else {
      violation = 'The geometry setter was called from outside layout (neither performResize() nor performLayout() were being run for this object).';
      if (owner != null && owner.debugDoingLayout)
        hint = 'Only the object itself can set its geometry. It is a contract violation for other objects to set it.';
    if (sizedByParent)
      contract = 'Because this RenderSliver has sizedByParent set to true, it must set its geometry in performResize().';
      contract = 'Because this RenderSliver has sizedByParent set to false, it must set its geometry in performLayout().';
    throw FlutterError(
      'RenderSliver geometry setter called incorrectly.\n'
      'The RenderSliver in question is:\n'
      '  $this'
  _geometry = value;