awaitLayout method

Future<Size?> awaitLayout(
  1. GlobalKey<State<StatefulWidget>> key, {
  2. int maxWaitFrames = 20,
  3. int stabilityFrames = 2,
  4. bool waitForEndOfFrame = true,
})

Wait for a widget's layout to stabilize using its GlobalKey.

Convenience wrapper around PostFrame.onLayout with context access.

Implementation

Future<Size?> awaitLayout(
  GlobalKey key, {
  int maxWaitFrames = 20,
  int stabilityFrames = 2,
  bool waitForEndOfFrame = true,
}) {
  return PostFrame.onLayout(
    key,
    maxWaitFrames: maxWaitFrames,
    stabilityFrames: stabilityFrames,
    waitForEndOfFrame: waitForEndOfFrame,
  );
}