show<T> static method
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,
})
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);
}
}