resolveMinWidth static method
Computes the minimum column width needed to display columnName without
truncation, including padding and sort-icon allowance.
Implementation
static double resolveMinWidth(
String columnName, {
TextStyle? headerStyle,
double paddingHorizontal = 24.0,
double sortIconWidth = 20.0,
double minFloor = 100.0,
double maxCap = 320.0,
}) {
final style = headerStyle ??
const TextStyle(fontWeight: FontWeight.bold, fontSize: 14);
final painter = TextPainter(
text: TextSpan(text: columnName, style: style),
textDirection: TextDirection.ltr,
)..layout();
final computed = painter.width + paddingHorizontal + sortIconWidth;
return computed.clamp(minFloor, maxCap);
}