calcSize method

  1. @override
Size? calcSize(
  1. BuildContext context, {
  2. double spacing = 0,
  3. Axis orientation = Axis.horizontal,
  4. T? param,
})
override

Implementation

@override
Size? calcSize(
  BuildContext context, {
  double spacing = 0,
  Axis orientation = Axis.horizontal,
  T? param,
}) {
  if (_width > 0 && _height > 0) {
    if (orientation == Axis.horizontal) {
      return Size(_width + spacing, _height);
    } else {
      return Size(_width, _height + spacing);
    }
  } else {
    final size = getTextSize(
      text(toolValue?.value) ?? '',
      style: style ?? Theme.of(context).textTheme.titleMedium,
    );

    if (orientation == Axis.horizontal) {
      return Size(size.width + spacing, size.height);
    } else {
      return Size(size.width, size.height + spacing);
    }
  }
}