error type icon set

This commit is contained in:
niuhuan 2021-11-02 15:54:34 +08:00
parent b32cc569e3
commit 26dbebeb3a
1 changed files with 8 additions and 2 deletions

View File

@ -20,20 +20,26 @@ class ContentError extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var type = errorType("$error"); var type = errorType("$error");
late String message; late String message;
late IconData iconData;
switch (type) { switch (type) {
case ERROR_TYPE_NETWORK: case ERROR_TYPE_NETWORK:
iconData = Icons.wifi_off_rounded;
message = "连接不上啦, 请检查网络"; message = "连接不上啦, 请检查网络";
break; break;
case ERROR_TYPE_PERMISSION: case ERROR_TYPE_PERMISSION:
iconData = Icons.highlight_off;
message = "没有权限或路径不可用"; message = "没有权限或路径不可用";
break; break;
case ERROR_TYPE_TIME: case ERROR_TYPE_TIME:
iconData = Icons.timer_off;
message = "请检查设备时间"; message = "请检查设备时间";
break; break;
case ERROR_TYPE_UNDER_REVIEW: case ERROR_TYPE_UNDER_REVIEW:
iconData = Icons.highlight_off;
message = "资源未审核或不可用"; message = "资源未审核或不可用";
break; break;
default: default:
iconData = Icons.highlight_off;
message = "啊哦, 被玩坏了"; message = "啊哦, 被玩坏了";
break; break;
} }
@ -61,7 +67,7 @@ class ContentError extends StatelessWidget {
Expanded(child: Container()), Expanded(child: Container()),
Container( Container(
child: Icon( child: Icon(
Icons.wifi_off_rounded, iconData,
size: iconSize, size: iconSize,
color: Colors.grey.shade600, color: Colors.grey.shade600,
), ),
@ -100,7 +106,7 @@ class ContentError extends StatelessWidget {
Expanded(child: Container()), Expanded(child: Container()),
Container( Container(
child: Icon( child: Icon(
Icons.wifi_off_rounded, iconData,
size: iconSize, size: iconSize,
color: Colors.grey.shade600, color: Colors.grey.shade600,
), ),