I have screen where show showcase screen component. Now these components can be anything and I want to dynamically find radius of the widget. Which I will pass to a custom painter to draw that shape with radius.
I have tried using finding anything useful in RenderObject but haven’t found anything.
Is there any method which can provide me RRect
object similar to below?
final box = globalKey.currentContext!.findRenderObject() as RenderBox;
final rect = size & box.localToGlobal(Offset.zero);
2
Answers
I resolved it by using context.widget like this,
A RenderObject will not be disposed until you replace it by another RenderObject of a different type, or remove the associated widget from the widget tree.