ensureVisibleCentered method

Future<void> ensureVisibleCentered()

Centers the widget identified by this key inside its nearest Scrollable ancestor. No-op when the key is not currently mounted.

Implementation

Future<void> ensureVisibleCentered() async {
  final ctx = currentContext;
  if (ctx == null) return;
  await Scrollable.ensureVisible(ctx, alignment: 0.5);
}