toWidget method

  1. @override
Widget toWidget(
  1. BuildContext context
)
override

Return the associated Widget

Implementation

@override
Widget toWidget(BuildContext context) => url == null
    ? Container()
    : CachedNetworkImage(
        key: id == null ? null : Key(id!),
        imageUrl: url!,
        width: width,
        height: height,
        fit: toBoxFit(fit),
        placeholder: (context, url) => Container(
            alignment: Alignment.center,
            width: 16.0,
            height: 16.0,
            child: const CircularProgressIndicator()),
        errorWidget: (context, url, error) {
          _logger.w('Error while downloading $url', error);
          return const Icon(Icons.error);
        });