提交 f33c18d3 authored 作者: yueweilu's avatar yueweilu

信息类提示使用 info类提示

上级 53287351
......@@ -235,6 +235,7 @@ class _RequestInterceptor extends Interceptor {
case DioExceptionType.badResponse:
final response = err.response;
final statusCode = response?.statusCode;
final code = int.tryParse(response?.data['code']?.toString() ?? '');
Console.log('************* ${response?.data}');
Console.log('******statusCode******* $statusCode');
// Console.log(response?.data);
......@@ -285,14 +286,15 @@ class _RequestInterceptor extends Interceptor {
msg = '$statusCode - Bad gateway';
// CustomToast.fail(msg);
break;
case 3000:
default:
// if (code == 901) UserStore.to.logout();
// msg = response?.data?['msg']?.toString() ?? msg;
msg = response?.data?['message']?.toString() ?? msg;
CustomToast.fail(msg);
if(code == 3001){
// Toast.show(msg);
CustomToast.info(msg);
}
else{
CustomToast.fail(msg);
}
break;
}
break;
......
......@@ -35,6 +35,7 @@ abstract class CustomToast {
..userInteractions = true
..successWidget = const CustomToastSuccess()
..errorWidget = const CustomToastFail()
..infoWidget = const CustomToastInfo()
..indicatorWidget = CustomLoadingIndicator(size: 60.w)
..dismissOnTap = false;
return EasyLoading.init(builder: builder);
......@@ -54,6 +55,13 @@ abstract class CustomToast {
EasyLoading.showSuccess(text);
}
static void info(String text) {
EasyLoading.instance
..maskType = EasyLoadingMaskType.clear
..userInteractions = true;
EasyLoading.showInfo(text);
}
static void fail(String text) {
EasyLoading.instance
..maskType = EasyLoadingMaskType.clear
......@@ -96,3 +104,15 @@ class CustomToastSuccess extends StatelessWidget {
);
}
}
class CustomToastInfo extends StatelessWidget {
const CustomToastInfo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Icon(
Icons.info,
color: Theme.of(context).colorScheme.primary,
size: 60.w,
);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论