show method
OverlayEntryControl
show(
- Widget builder(
- BuildContext context
- required String id,
- required int zindex,
- Color backgroundColor = Colors.transparent,
- OverlayLayoutTypeEnum type = OverlayLayoutTypeEnum.custom,
- bool dismissible = false,
override
Return an id of the entry in entries.
Implementation
@override
OverlayEntryControl show(
Widget Function(BuildContext context) builder, {
required String id,
required int zindex,
Color backgroundColor = Colors.transparent,
OverlayLayoutTypeEnum type = OverlayLayoutTypeEnum.custom,
bool dismissible = false,
}) {
late OverlayEntryControl control;
OverlayEntryData? currentData = getOverlayEntryData(id);
final requesterId = const UuidV4().generate();
_addOverlayRequester(id, requesterId);
if (currentData != null) {
control = OverlayEntryControl(
currentData,
this,
() => retake(currentData),
() => _removeOverlayRequester(id, requesterId),
);
return control;
}
final entry = OverlayEntry(
builder: (context) {
final widget = builder(context);
return OverlayLayout(
type: type,
backgroundColor: backgroundColor,
onTap: dismissible
? () async {
await control.dismiss();
}
: null,
child: widget,
);
},
);
final data = insert(id, zindex, entry);
control = OverlayEntryControl(
data,
this,
() => retake(data),
() => _removeOverlayRequester(id, requesterId),
);
return control;
}