showLoading function
CancelFunc
showLoading(
- String msg, {
- VoidCallback? onClose,
- double pbSize = 36,
- Color pbColor = BaseColors.cWhite,
显示加载中 @param: msg 消息 @param: onClose 关闭方法回调 @return: 关闭方法
Implementation
CancelFunc showLoading(
String msg, {
VoidCallback? onClose,
double pbSize = 36,
Color pbColor = BaseColors.cWhite,
}) {
return BotToast.showCustomLoading(
backButtonBehavior: BackButtonBehavior.ignore, // 拦截返回按钮点击
onClose: onClose,
toastBuilder: (func) {
return Container(
padding: const EdgeInsets.all(12),
alignment: Alignment.center,
width: loadingSize,
height: loadingSize,
decoration: const BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.all(Radius.circular(8)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
mProgressIndicator(size: pbSize, color: pbColor),
Padding(
padding: const EdgeInsets.fromLTRB(8, 20, 8, 4),
child: Text(
msg,
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.white, fontSize: 14),
),
),
],
),
);
},
);
}