show method

  1. @override
Loader show(
  1. Widget builder(
    1. BuildContext context
    ), {
  2. String? id,
  3. Color backgroundColor = Colors.transparent,
  4. OverlayLayoutTypeEnum type = OverlayLayoutTypeEnum.custom,
  5. bool dismissible = false,
})
override

Return an id of the entry in entries.

Implementation

@override
Loader show(
  Widget Function(BuildContext context) builder, {
  String? id,
  Color backgroundColor = Colors.transparent,
  OverlayLayoutTypeEnum type = OverlayLayoutTypeEnum.custom,
  bool dismissible = false,
}) {
  final _id = id ?? const UuidV4().generate();
  final loader = Loader(
    overlayId: _id,
    dismiss: () {
      hide(_id);
    },
  );
  final entry = OverlayEntry(
    builder: (context) {
      final widget = builder(context);
      return OverlayLayout(
        type: type,
        backgroundColor: backgroundColor,
        onTap: dismissible
            ? () async {
                await loader.dismiss.call();
              }
            : null,
        child: widget,
      );
    },
  );
  insert(_id, entry);
  return loader;
}