DpIcon function

Widget DpIcon(
  1. dynamic ImageName, {
  2. double Size = 20.0,
  3. dynamic loadingIcon,
})

Implementation

Widget DpIcon(ImageName, {double Size = 20.0, loadingIcon}) {
  if (ImageName.toString().contains("dps")) {
    return SvgPicture.network(
      'https://dev.w3.org/SVG/tools/svgweb/samples/svg-asd/',
      semanticsLabel: 'A shark?!',
      height: Size,
      width: Size,
      placeholderBuilder: (BuildContext context) => Container(
          height: Size, width: Size, child: const CircularProgressIndicator()),
    );
  } else if (ImageName.toString().contains("dpp")) {
    return Image.network(
      'https://picsum.photos/seed/picsum/200/300',
      fit: BoxFit.cover,
      height: Size,
      width: Size,
    );
  } else if (ImageName.toString().contains("Assets/DPSvg")) {
    return SvgPicture.asset(
      ImageName,
      height: Size,
      width: Size,
      package: "dp_icon",
      matchTextDirection: true,
    );
  } else if (ImageName.toString().contains("Assets/DPPng")) {
    return Image.asset(
      ImageName,
      package: "dp_icon",
    );
  } else {
    return Icon(Icons.error);
  }
}