show method
Displays the loading dialog and returns a Future that resolves when the dialog is dismissed.
This method shows the loading dialog on the screen and returns a Future that resolves when the dialog is dismissed.
Example:
var loadingDialog = LoadingDialog(
message: 'Loading...',
// ... other parameters ...
);
await loadingDialog.show(context);
Implementation
show(BuildContext context) async {
return await showDialog(
context: context,
barrierDismissible: barrierDismissible,
builder: (context) {
Size screenSize = MediaQuery.of(context).size;
bool isPortrait =
MediaQuery.of(context).orientation == Orientation.portrait;
return Center(
child: Material(
elevation: elevation,
borderRadius: BorderRadius.circular(dialogBorderRadius),
child: Container(
width: dialogWidth ??
(isPortrait ? screenSize.width : screenSize.height) * 0.85,
height: dialogHeight,
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.all(30.0),
child: progressbarWidget ??
CircularProgressIndicator(
color: progressbarColor ??
Theme.of(context).colorScheme.primary,
),
),
if (message != null)
Text(
message!,
style: messageStyle,
)
else if (messageWidget != null)
messageWidget!,
],
),
),
),
);
},
);
}