show method
dynamic
show(
- BuildContext context, {
- String? message,
- bool isDismissible = kDebugMode,
- required ThemeData theme,
- required ImageEditorTheme imageEditorTheme,
- required ImageEditorDesignModeE designMode,
- required I18n i18n,
Displays a loading dialog in the given context
.
message
is an optional parameter to customize the loading message.isDismissible
determines if the dialog can be dismissed.theme
is the theme data for styling the dialog.imageEditorTheme
is the theme specific to the image editor.designMode
specifies the design mode for the image editor.i18n
provides internationalization support.
Returns a Future that completes when the dialog is dismissed.
Implementation
show(
BuildContext context, {
String? message,
bool isDismissible = kDebugMode,
required ThemeData theme,
required ImageEditorTheme imageEditorTheme,
required ImageEditorDesignModeE designMode,
required I18n i18n,
}) async {
if (message == null) {
msg = i18n.various.loadingDialogMsg;
} else {
msg = message;
}
_isVisible = true;
return showAdaptiveDialog(
context: context,
barrierDismissible: isDismissible,
builder: (context) {
if (_isDisposed) Navigator.of(context).pop();
return AlertDialog.adaptive(
backgroundColor: theme.cardColor,
contentPadding:
const EdgeInsets.symmetric(vertical: 16, horizontal: 20),
content: PopScope(
canPop: isDismissible,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 500),
child: StatefulBuilder(builder: (context, StateSetter setState) {
state = setState;
return Padding(
padding: const EdgeInsets.only(top: 3.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(right: 20.0),
child: SizedBox(
height: 40,
width: 40,
child: FittedBox(
child: PlatformCircularProgressIndicator(
designMode: designMode,
),
),
),
),
Expanded(
child: Text(
_msg,
style: platformTextStyle(
context,
designMode,
).copyWith(
fontSize: 16,
color: imageEditorTheme.loadingDialogTextColor,
),
textAlign: TextAlign.start,
),
),
],
),
);
}),
),
),
);
},
);
}