imageLoader function

Widget imageLoader(
  1. dynamic context,
  2. dynamic child,
  3. dynamic loadingProgress
)

Implementation

Widget imageLoader(context, child, loadingProgress) {
  if ((loadingProgress?.cumulativeBytesLoaded ?? double.infinity) <
      (loadingProgress?.expectedTotalBytes ?? 0)) {
    final percentage = (loadingProgress?.cumulativeBytesLoaded ?? 0.0) /
        (loadingProgress?.expectedTotalBytes ?? 1.0);
    return CircularProgressIndicator(
      value: (percentage > 1 ? 0 : percentage).toDouble(),
    );
  }
  return child;
}