calculateWidgetSize static method

Size? calculateWidgetSize(
  1. BuildContext? context
)

Calculates the size of a widget

Implementation

static Size? calculateWidgetSize(BuildContext? context) {
  if (context == null) return null;

  try {
    final RenderBox renderBox = context.findRenderObject() as RenderBox;
    return renderBox.size;
  } catch (e) {
    debugPrint('Error calculating widget size: $e');
    return null;
  }
}