globalStateWidgetBuilder property

Widget Function(BuildContext context, ExtendedImageState state) globalStateWidgetBuilder
getter/setter pair

default state widget builder

Implementation

static Widget Function(
  BuildContext context,
  ExtendedImageState state,
) globalStateWidgetBuilder = (
  BuildContext context,
  ExtendedImageState state,
) {
  switch (state.extendedImageLoadState) {
    case LoadState.loading:
      return Container(
        alignment: Alignment.center,
        child: Theme.of(context).platform == TargetPlatform.iOS
            ? const CupertinoActivityIndicator(
                animating: true,
                radius: 16.0,
              )
            : CircularProgressIndicator(
                strokeWidth: 2.0,
                valueColor: AlwaysStoppedAnimation<Color>(
                    Theme.of(context).primaryColor),
              ),
      );

    case LoadState.completed:
      return state.completedWidget;
    case LoadState.failed:
      return Container(
        alignment: Alignment.center,
        child: GestureDetector(
          onTap: () {
            state.reLoadImage();
          },
          child: const Text('Failed to load image'),
        ),
      );
  }
};