imageNetworkLocal function

Widget imageNetworkLocal(
  1. String url, {
  2. Color? color,
  3. double? width,
  4. double? height,
  5. BoxFit fit = BoxFit.contain,
  6. Clip clipBehavior = Clip.hardEdge,
  7. BorderRadius borderRadius = BorderRadius.zero,
  8. EdgeInsets margin = EdgeInsets.zero,
  9. VoidCallback? onTap,
  10. required String? placeholder,
})

Implementation

Widget imageNetworkLocal(
    final String url, {
      final Color? color,
      final double? width,
      final double? height,
      final BoxFit fit = BoxFit.contain,
      final Clip clipBehavior = Clip.hardEdge,
      final BorderRadius borderRadius = BorderRadius.zero,
      final EdgeInsets margin = EdgeInsets.zero,
      final VoidCallback? onTap,
      required final String? placeholder,
    }) =>
    GestureDetector(
      onTap: onTap,
      child: Container(
        clipBehavior: Clip.hardEdge,
        decoration: BoxDecoration(borderRadius: borderRadius),
        margin: margin,
        width: width,
        height: height,
        child: url.length <= 10
            ? placeholder == null
            ? const SizedBox()
            : imageAsset(
          placeholder,
          width: width,
          height: height,
          fit: fit,
          clipBehavior: clipBehavior,
        )
            : url.substring(url.length - 3) == "svg"
            ? SvgPicture.network(
          url,
          color: color,
          width: width,
          height: height,
          fit: fit,
          placeholderBuilder: placeholder == null
              ? null
              : (final _) => imageAsset(
            placeholder,
            width: width,
            height: height,
            fit: fit,
            clipBehavior: clipBehavior,
          ),
        )
            : FadeInImage.assetNetwork(
          image: url,
          width: width,
          height: height,
          fit: fit,
          imageErrorBuilder: placeholder == null
              ? null
              : (final _, final __, final ___) => imageAsset(
            placeholder,
            color: color,
            width: width,
            height: height,
            fit: fit,
            clipBehavior: clipBehavior,
          ),
          placeholder: placeholder!,
        ),
      ),
    );