calcSize method
Size?
calcSize(
- BuildContext context, {
- double spacing = 0,
- Axis orientation = Axis.horizontal,
- T? param,
override
Implementation
@override
Size? calcSize(
BuildContext context, {
double spacing = 0,
Axis orientation = Axis.horizontal,
T? param,
}) {
final w = _width ?? 0;
final h = _height ?? 0;
if (w > 0 && h > 0) {
if (orientation == Axis.horizontal) {
return Size(w + spacing, h);
} else {
return Size(w, h + spacing);
}
} else {
final theme = Theme.of(context);
final size = getTextSize(
text(param ?? toolValue?.value) ?? '',
style: textStyle ??
TextStyle(
color: fontColor ?? theme.colorScheme.onSurface,
fontSize: fontSize,
),
);
final extraWidth = 24 /* extra padding for TextButton */ +
(iconSize ?? 0) +
(addPaddingForOptionsDropdown && onOption != null ? 24 : 0);
if (orientation == Axis.horizontal) {
return Size(size.width + extraWidth + spacing, size.height);
} else {
return Size(size.width + extraWidth, size.height + spacing);
}
}
}