getEmptyWidgetByState static method

Widget getEmptyWidgetByState(
  1. BuildContext context,
  2. AbnormalState status, {
  3. Image? img,
  4. EmptyStatusIndexedActionClickCallback? action,
})

通过状态获取对应空页面widget status: 页面状态类型为EmptyState

Implementation

static Widget getEmptyWidgetByState(
    BuildContext context, AbnormalState status,
    {Image? img, EmptyStatusIndexedActionClickCallback? action}) {
  if (AbnormalState.getDataFailed == status) {
    return AbnormalStateWidget(
      img: img ?? PhoenixTools.getAssetImage(EmptyAssets.noData),
      title: BrnIntl.of(context).localizedResource.fetchErrorAndRetry,
      operateTexts: <String>[
        BrnIntl.of(context).localizedResource.clickPageAndRetry
      ],
      action: action,
    );
  } else if (AbnormalState.networkConnectError == status) {
    return AbnormalStateWidget(
      img: img ?? PhoenixTools.getAssetImage(EmptyAssets.networkError),
      title: BrnIntl.of(context).localizedResource.netErrorAndRetryLater,
      operateTexts: <String>[
        BrnIntl.of(context).localizedResource.clickPageAndRetry
      ],
      action: action,
    );
  } else if (AbnormalState.noData == status) {
    return AbnormalStateWidget(
        img: img ?? PhoenixTools.getAssetImage(EmptyAssets.noData),
        title: BrnIntl.of(context).localizedResource.noDataTip);
  } else {
    return const SizedBox.shrink();
  }
}