previewWidgetLoadStateChanged method

Widget previewWidgetLoadStateChanged(
  1. BuildContext context,
  2. ExtendedImageState state, {
  3. bool hasLoaded = false,
})

Common image load state changed callback with Widget. 图片加载状态的部件回调

Implementation

Widget previewWidgetLoadStateChanged(
  BuildContext context,
  ExtendedImageState state, {
  bool hasLoaded = false,
}) {
  switch (state.extendedImageLoadState) {
    case LoadState.completed:
      if (hasLoaded) {
        return state.completedWidget;
      }
      return FadeImageBuilder(child: state.completedWidget);
    case LoadState.failed:
      return failedItemBuilder(context);
    case LoadState.loading:
      return const SizedBox.shrink();
  }
}