imageLoadingBuilder static method

Widget imageLoadingBuilder(
  1. BuildContext context,
  2. Widget child,
  3. ImageChunkEvent? loadingProgress
)

Image loading builder.

Implementation

static Widget imageLoadingBuilder(
    BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
  if (loadingProgress == null) return child;
  return Center(
    child: SizedBox(
      width: 20.0,
      height: 20.0,
      child: CircularProgressIndicator(
        color: Colors.black,
        value: loadingProgress.expectedTotalBytes != null
            ? loadingProgress.cumulativeBytesLoaded /
                loadingProgress.expectedTotalBytes!
            : null,
        strokeWidth: 1.5,
      ),
    ),
  );
}