getIntrinsicWidth method

  1. @override
int getIntrinsicWidth(
  1. int height
)
override

Computes the intrinsic width of this widget under the given height constraint.

Implementation

@override
int getIntrinsicWidth(int height) {
  // Run within a zone specifying #isMeasuringIntrinsics = true to prevent
  // temporary mounting of children from polluting or corrupting the global
  // GlobalKey registry.
  return runZoned(() {
    final rootContext = StatefulElement(this)..mount(null);
    final w = rootContext.childElement?.widget.getIntrinsicWidth(height) ?? 0;
    rootContext.unmount();
    return w;
  }, zoneValues: {#isMeasuringIntrinsics: true});
}