showToolbar method

void showToolbar()

Shows the toolbar by inserting it into the context's overlay.

This method requires a fully laid-out render tree (as it calls RenderBox.localToGlobal), so it should not be called during the build or layout phases.

Implementation

void showToolbar() {
  assert(
    SchedulerBinding.instance.schedulerPhase != SchedulerPhase.persistentCallbacks,
    'showToolbar must not be called during the build or layout phase.',
  );
  _updateSelectionOverlay();

  if (selectionControls != null && selectionControls is! TextSelectionHandleControls) {
    _selectionOverlay.showToolbar();
    return;
  }

  if (contextMenuBuilder == null) {
    return;
  }

  assert(context.mounted);
  _selectionOverlay.showToolbar(context: context, contextMenuBuilder: contextMenuBuilder);
  return;
}