To show the user that application is working or not stuff at a particular functionality.
loadingDialog(BuildContext context, {required String text}) {
return showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return SizedBox(
width: 400,
child: AlertDialog(
elevation: 5.0,
scrollable: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
title: SizedBox(
width: 400,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
CircularProgressIndicator(
backgroundColor: Colors.black,
valueColor: AlwaysStoppedAnimation(Colors.red),
),
horizontalSpacer(width: 10),
Text(text),
],
),
),
),
);
},
);
}