ktoast function

void ktoast(
  1. String? text, {
  2. EasyLoadingToastPosition position = EasyLoadingToastPosition.bottom,
  3. int? seconds,
})

显示toast

position:显示位置 seconds:显示时长,单位-秒

Implementation

void ktoast(
  String? text, {
  EasyLoadingToastPosition position = EasyLoadingToastPosition.bottom,
  int? seconds,
}) {
  if (text == null || text.kisBlank()) {
    return;
  }
  var config = UiPlatform.get.getEasyLoadingConfig();
  EasyLoading.instance
    ..indicatorColor = config.loadingIndicatorColor
    ..fontSize = config.fontSize ?? 15.sp
    ..backgroundColor = config.toastBackgroundColor
    ..textColor = config.toastTextColor
    ..loadingStyle = EasyLoadingStyle.custom;
  if (seconds != null && seconds > 0) {
    EasyLoading.showToast(text,
        toastPosition: position, duration: Duration(seconds: seconds));
  } else {
    EasyLoading.showToast(text, toastPosition: position);
  }
}