WidgetParams.fromContext constructor
WidgetParams.fromContext(
- BuildContext? context
Implementation
WidgetParams.fromContext(BuildContext? context) {
// Get the widget RenderObject
final RenderObject? object = context?.findRenderObject();
// Get the dimensions and position of the widget
final translation =
object?.getTransformTo(null).getTranslation() ?? vector.Vector3.zero();
final Size size = object?.semanticBounds.size ?? Size.zero;
xPosition = translation.x;
yPosition = translation.y;
rect = Rect.fromLTWH(translation.x, translation.y, size.width, size.height);
}