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.

Implementation

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

Implementation

set geometry(SliverGeometry value) {
  assert(!(debugDoingThisResize && debugDoingThisLayout));
  assert(sizedByParent || !debugDoingThisResize);
  assert(() {
    if ((sizedByParent && debugDoingThisResize) ||
        (!sizedByParent && debugDoingThisLayout))
      return true;
    assert(!debugDoingThisResize);
    String contract, violation, hint;
    if (debugDoingThisLayout) {
      assert(sizedByParent);
      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().';
    else
      contract = 'Because this RenderSliver has sizedByParent set to false, it must set its geometry in performLayout().';
    throw FlutterError(
      'RenderSliver geometry setter called incorrectly.\n'
      '$violation\n'
      '$hint\n'
      '$contract\n'
      'The RenderSliver in question is:\n'
      '  $this'
    );
  }());
  _geometry = value;
}