getImageFromURL static method

Widget getImageFromURL({
  1. required String url,
  2. double? height,
  3. double? width,
  4. BoxFit? fit,
  5. Alignment? alignment,
})

Implementation

static Widget getImageFromURL(
    {required String url,
    double? height,
    double? width,
    BoxFit? fit,
    Alignment? alignment}) {
  try {
    return FadeInImage.memoryNetwork(
      placeholder: kTransparentImage,
      image: url,
      fit: BoxFit.cover,
      height: double.infinity,
      width: double.infinity,
      alignment: Alignment.center,
    );
  } catch (_) {
    return Image(
        image: AssetImage('assets/images/image_not_available.png'),
        height: height,
        width: width);
  }
}