cachedImageForItem function

Widget cachedImageForItem(
  1. String url, {
  2. double? height,
  3. double? width,
  4. BoxFit? boxFit,
})

Web-specific image widget.

Creates an HtmlElementView that renders an underlying HTML <img> element. Useful for displaying GIFs or images directly through the browser rendering engine.

Parameters:

  • url : Network image URL.
  • height : Optional widget height.
  • width : Optional widget width.
  • boxFit : Reserved for future use (currently ignored).

Returns a SizedBox containing an HtmlElementView.

Implementation

Widget cachedImageForItem(
    String url, {
      double? height,
      double? width,
      BoxFit? boxFit,
    }) {
  final viewId = 'img-view-${url.hashCode}';

  registerGifView(url, viewId);

  return SizedBox(
    height: height ?? 100,
    width: width ?? 100,
    child: HtmlElementView(
      viewType: viewId,
    ),
  );
}