showKDialogWithLoadingIndicator function
Implementation
Future<void Function()> showKDialogWithLoadingIndicator(
BuildContext context) async {
final completer = Completer<void Function()>();
showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
dismiss() => Navigator.of(context).pop();
if (!completer.isCompleted) {
completer.complete(dismiss);
}
return const PopScope(
canPop: false,
child: AlertDialog(
contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent,
backgroundColor: Colors.transparent,
elevation: 0,
content: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: Colors.white),
],
),
),
);
},
);
return completer.future;
}