show<T> static method

Future<T?> show<T>(
  1. BuildContext context, {
  2. required Future<T?> loadFuture,
  3. String? key,
  4. Curve? curve,
  5. bool? dismissible,
  6. Color? barrierColor,
  7. Curve? reverseCurve,
  8. Alignment? alignment,
  9. Stream<String>? hintStream,
  10. LoadingOverlayStyle? style,
  11. bool cancelWithAnime = false,
  12. Stream<double>? progressStream,
})

Implementation

static Future<T?> show<T>(
  BuildContext context, {
  required Future<T?> loadFuture,
  String? key,
  Curve? curve,
  bool? dismissible,
  Color? barrierColor,
  Curve? reverseCurve,
  Alignment? alignment,
  Stream<String>? hintStream,
  LoadingOverlayStyle? style,
  bool cancelWithAnime = false,
  Stream<double>? progressStream,
}) async {
  _customOverlay.cancelAll();
  key ??= DateTime.now().microsecondsSinceEpoch.toString();
  final themeData = LoadingThemeData.of(context);
  try {
    _customOverlay.insert(
      context,
      key: key,
      interceptPop: false,
      alignment: alignment ?? themeData.alignment,
      dismissible: dismissible ?? themeData.dismissible,
      barrierColor: barrierColor ?? themeData.barrierColor,
      builder: (_, animation, child) {
        return ScaleTransition(
          scale: CurvedAnimation(
            parent: animation,
            curve: curve ?? themeData.curve,
            reverseCurve: reverseCurve ?? themeData.reverseCurve,
          ),
          child: child,
        );
      },
      child: LoadingOverlay(
        hintStream: hintStream,
        progressStream: progressStream,
        style: style ?? themeData.style,
      ),
    );
    return await loadFuture;
  } catch (e) {
    rethrow;
  } finally {
    _customOverlay.cancel(key, null, cancelWithAnime);
  }
}