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,
}) {
  return switch (state.extendedImageLoadState) {
    LoadState.completed => hasLoaded
        ? state.completedWidget
        : FadeImageBuilder(child: state.completedWidget),
    LoadState.failed => failedItemBuilder(context),
    LoadState.loading => const SizedBox.shrink(),
  };
}