show method
void
show(
- BuildContext context, {
- String? message,
- bool isDismissible = kDebugMode,
- ThemeData? theme,
- required ProImageEditorConfigs configs,
Displays a loading dialog in the given context
.
Parameters:
context
: The build context in which to display the dialog.message
: An optional parameter to customize the loading message.isDismissible
: Determines if the dialog can be dismissed. Defaults to the value ofkDebugMode
.theme
: The theme data for styling the dialog. If not provided, the current theme of the context is used.configs
: Configuration settings for the Pro Image Editor.
The method creates an overlay entry with an animated opacity transition,
and inserts it into the overlay stack. Custom widgets for the loading
dialog can be provided via configs.customWidgets.loadingDialog
.
Implementation
void show(
BuildContext context, {
String? message,
bool isDismissible = kDebugMode,
ThemeData? theme,
required ProImageEditorConfigs configs,
}) async {
theme ??= configs.theme ?? Theme.of(context);
message ??= configs.i18n.various.loadingDialogMsg;
var animationKey = GlobalKey<OpacityOverlayAnimationState>();
OverlayEntry overlay = OverlayEntry(
builder: (BuildContext context) => OpacityOverlayAnimation(
key: animationKey,
onAnimationDone: () {
/// Remove the overlay after the animation is done.
_removeOverlay();
},
child: configs.dialogConfigs.widgets.loadingDialog != null
? configs.dialogConfigs.widgets.loadingDialog!(message!, configs)
: Stack(
children: [
_buildBackdrop(context, isDismissible),
_buildDefaultDialog(
theme: theme!,
context: context,
configs: configs,
message: message!,
)
],
),
),
);
Overlay.of(context).insert(overlay);
_overlays.add(LoadingOverlayDetails(
entry: overlay,
isDismissible: isDismissible,
animationKey: animationKey,
));
notifyListeners();
}