kshowError function

void kshowError(
  1. String? text, {
  2. int? seconds,
})

显示错误 seconds:显示时长,单位-秒

Implementation

void kshowError(
  String? text, {
  int? seconds,
}) {
  if (text == null || text.kisBlank()) {
    return;
  }
  var config = UiPlatform.get.getEasyLoadingConfig();
  EasyLoading.instance
    ..loadingStyle = EasyLoadingStyle.custom
    ..backgroundColor = config.errorBackgroundColor
    ..textColor = config.errorTextColor
    ..fontSize = config.fontSize ?? 15.sp
    ..indicatorColor = Colors.white
    ..errorWidget = config.errorWidget;
  // ..errorWidget = Icon(
  //   Icons.clear,
  //   color: Colors.white,
  //   size: EasyLoading.instance.indicatorSize,
  if (seconds != null && seconds > 0) {
    EasyLoading.showError(text, duration: Duration(seconds: seconds));
  } else {
    EasyLoading.showError(text);
  }
}