render method
OverlayEntry
render(
- BuildContext context, {
- ValueChanged<
TapDownDetails> ? onClose, - required Offset position,
- required WidgetBuilder popupBuilder,
Render overlay entry on the screen with dismiss logic
Implementation
OverlayEntry render(
BuildContext context, {
ValueChanged<TapDownDetails>? onClose,
required Offset position,
required WidgetBuilder popupBuilder,
}) {
final _createdEntry = OverlayEntry(
builder: (context) => GestureDetector(
behavior: HitTestBehavior.opaque,
onTapDown: onClose,
child: Material(
color: Colors.transparent,
type: MaterialType.canvas,
child: Stack(
children: [
CustomSingleChildLayout(
delegate: PopupOverlayLayoutDelegate(position),
child: TapRegion(
onTapOutside: (_) => dismiss(),
child: popupBuilder(context),
),
),
],
),
),
),
);
Overlay.of(context).insert(_createdEntry);
_overlayEntry = _createdEntry;
return _createdEntry;
}