setLayoutAxisLength method

  1. @override
void setLayoutAxisLength(
  1. LayoutAxis axis,
  2. double? value
)
override

A helper function to set the appropriate layout dimension based on axis. This is needed because currently there's no other way, at the LayoutComponent level, to selective set width or height without setting both. e.g. if axis is LayoutAxis.y, then that's the y axis.

Implementation

@override
void setLayoutAxisLength(LayoutAxis axis, double? value) {
  super.setLayoutAxisLength(axis, value);
  final child = this.child;
  if (inflateChild && child != null && value != null) {
    // We want to set the child's size.
    if (child is LayoutComponent) {
      child.setLayoutAxisLength(axis, value);
    } else {
      child.size[axis.axisIndex] = value;
    }
  }
}