getColumnWidth static method
- required List<
String> texts, - required BuildContext context,
- TextStyle? textStyle,
Returns the width of column in the picker.
This method is intended for testing only. It calculates the width of the widest column in the picker based on the provided list of texts and the given BuildContext.
Implementation
@visibleForTesting
static double getColumnWidth({
required List<String> texts,
required BuildContext context,
TextStyle? textStyle,
}) {
return texts.map((String text) => TextPainter.computeMaxIntrinsicWidth(
text: TextSpan(
style: textStyle ?? _themeTextStyle(context),
text: text,
),
textDirection: Directionality.of(context),
)).reduce(math.max);
}