buildWebNativeImage function

Widget buildWebNativeImage({
  1. required String imageUrl,
  2. BoxFit fit = BoxFit.cover,
  3. double? height,
  4. double? width,
  5. Widget? placeholder,
  6. Widget? errorWidget,
  7. bool circular = false,
})

Stub for non-web platforms — just uses Image.network

Implementation

Widget buildWebNativeImage({
  required String imageUrl,
  BoxFit fit = BoxFit.cover,
  double? height,
  double? width,
  Widget? placeholder,
  Widget? errorWidget,
  bool circular = false,
}) {
  final child = Image.network(
    imageUrl,
    fit: fit,
    height: height,
    width: width,
    loadingBuilder: (context, child, loadingProgress) {
      if (loadingProgress == null) return child;
      return placeholder ?? const Center(child: CircularProgressIndicator(strokeWidth: 2));
    },
    errorBuilder: (context, error, stackTrace) =>
        errorWidget ?? const Icon(Icons.image_not_supported),
  );
  return circular ? ClipOval(child: child) : child;
}