showToolbar method
- BuildContext? context,
- WidgetBuilder? contextMenuBuilder,
Shows the toolbar by inserting it into the context
's overlay.
Implementation
void showToolbar({
BuildContext? context,
WidgetBuilder? contextMenuBuilder,
}) {
if (contextMenuBuilder == null) {
if (_toolbar != null) {
return;
}
_toolbar = OverlayEntry(builder: _buildToolbar);
Overlay.of(this.context, rootOverlay: true, debugRequiredFor: debugRequiredFor).insert(_toolbar!);
return;
}
if (context == null) {
return;
}
final RenderBox renderBox = context.findRenderObject()! as RenderBox;
_contextMenuController.show(
context: context,
contextMenuBuilder: (BuildContext context) {
return _SelectionToolbarWrapper(
visibility: toolbarVisible,
layerLink: toolbarLayerLink,
offset: -renderBox.localToGlobal(Offset.zero),
child: contextMenuBuilder(context),
);
},
);
}