출처 :
https://blog.gskinner.com/archives/2020/09/flutter-tricks-widget-size-position.html
RenderBox rb = context.findRenderObject() as RenderBox;
return rb?.size ?? Size.zero;
Future.microtask(() {
RenderBox rb = key.currentContext.findRenderObject() as RenderBox;
if (rb?.size != null) {
callback(size);
}
});
RenderBox rb = context.findRenderObject() as RenderBox;
return rb?.localToGlobal(offset ?? Offset.zero);
RenderBox rb = context.findRenderObject() as RenderBox;
if(rb != null && size rb.size != Size.zero){
Offset centerPtInWidgetSpace = Offset(size.width/2, size.height/2);
Offset centerPtInScreenSpace = rb.localToGlobal(centerPtInLocal);
print("Our global center is: $centerPtInScreenSpace);
}