postFrameCallback method
- dynamic _
If the size of the widget has changed, call the onChange callback
Args: _: This is the callback function that will be called after the frame is rendered.
Returns: A function that is called after the frame is rendered.
Implementation
void postFrameCallback(_) {
final BuildContext? context = widgetKey.currentContext;
if (context == null) {
return;
}
final Size? newSize = context.size;
if (oldSize == newSize) {
return;
}
oldSize = newSize;
widget.onChange(newSize);
}