showProgressDialog method
void
showProgressDialog({})
Implementation
void showProgressDialog({
Color barrierColor = const Color(0x55222222),
String? textToBeDisplayed,
Duration dismissAfter = const Duration(minutes: 180),
Function? onDismiss,
Stream<double>? streamValue,
Stream<String>? streamText,
Color? progressColor,
}) {
dismissProgressDialog().then((_) {
isDismissed = false;
showModernFormGeneralDialog(
barrierColor: barrierColor,
pageBuilder: (context, animation1, animation2) {
return _ModernFormProgressDialog(
child: Container(
padding: const EdgeInsets.all(20),
child:
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
streamValue != null
? StreamBuilder<double>(
stream: streamValue,
initialData: 0,
builder: (context, snapshot) {
return ModernFormProgressIndicator(
value: snapshot.data ?? 0,
color: progressColor,
);
})
: ModernFormProgressIndicator(color: progressColor),
streamText != null
? Padding(
padding: EdgeInsets.only(top: 20),
child: StreamBuilder<String>(
stream: streamText,
initialData: "",
builder: (context, snapshot) {
return Material(
color: Colors.transparent,
child: Text(
snapshot.data ?? "",
style: TextStyle(
color: Colors.white,
fontSize: ScreenUtil().setSp(14),
),
textAlign: TextAlign.center,
),
);
}))
: textToBeDisplayed == null
? Padding(
padding: EdgeInsets.all(0),
)
: Padding(
padding: EdgeInsets.only(top: 20),
child: Material(
color: Colors.transparent,
child: Text(
textToBeDisplayed,
style: TextStyle(
color: Colors.white,
fontSize: ScreenUtil().setSp(14),
),
textAlign: TextAlign.center,
),
))
])),
);
},
barrierDismissible: false,
transitionDuration: const Duration(milliseconds: 100),
).then((dismissed) {
isDismissed = dismissed as bool?;
});
_timer = Timer(dismissAfter, () {
dismissProgressDialog();
if (onDismiss != null) onDismiss();
});
});
}