show method

  1. @override
OverlayEntryControl show(
  1. Widget builder(
    1. BuildContext context
    ), {
  2. required String id,
  3. required int zindex,
  4. Color backgroundColor = Colors.transparent,
  5. OverlayLayoutTypeEnum type = OverlayLayoutTypeEnum.custom,
  6. 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;
}