estimateWidth method

double estimateWidth(
  1. BuildContext context
)

Implementation

double estimateWidth(BuildContext context) {
  double width = switch (size) {
    TInputSize.xs => 26.0,
    TInputSize.sm => 36.0,
    TInputSize.md || null => 42.0,
    TInputSize.lg => 52.0,
  };
  if (label != null) {
    width += 8.0; // Gap between switch and label
    width += WidthHelper.measureText(context, label!, TextStyle(fontSize: size.fontSize, letterSpacing: 0.9));
  }
  return width;
}