init static method

OverlayLoaderManager init({
  1. String? semantics,
  2. Color? backgroundColor,
  3. Color colorProgressIndicator = Colors.white,
})

Implementation

static OverlayLoaderManager init({
  String? semantics,
  Color? backgroundColor,
  Color colorProgressIndicator = Colors.white,
}) {
  backgroundColor ??= Colors.black.withOpacity(0.5);
  if (!getIt.isRegistered<OverlayLoaderManager>()) {
    var overlayEntry = OverlayEntry(
      builder: (context) => IgnorePointer(
        child: Positioned.fill(
          child: Semantics(
            label: semantics ?? 'Loading',
            child: ColoredBox(
              color: backgroundColor!,
              child: Center(
                child: ExcludeSemantics(
                  child: CircularProgressIndicator(
                    color: colorProgressIndicator,
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
    getIt.registerSingleton<OverlayLoaderManager>(
      OverlayLoaderManager(overlayEntry),
    );
  }
  return getIt.get<OverlayLoaderManager>();
}