buildCicleImagWidget static method

dynamic buildCicleImagWidget(
  1. String? imgPath, {
  2. Key? key,
  3. String placeholder = "none",
  4. double? width,
  5. double? height,
  6. BoxFit fit = BoxFit.cover,
  7. EdgeInsetsGeometry? margin,
  8. EdgeInsetsGeometry? padding,
  9. Color? backgroundColor,
  10. bool isCircle = true,
  11. double roundRadius = 5,
})

Implementation

static buildCicleImagWidget(
    String? imgPath,
    {
      Key? key,
      String placeholder :"none",
      double? width,
      double? height,
      BoxFit fit: BoxFit.cover,
      EdgeInsetsGeometry? margin,
      EdgeInsetsGeometry? padding,
      Color? backgroundColor,
      bool isCircle:true,
      double roundRadius:5
    }){
  print('buildCicleWidget-->imgPath=$imgPath');
  return
    isCircle?
    Container(
      margin:margin,
      padding: padding,
      width: PxUtils.setSize(width??0),
      height: PxUtils.setSize(height??0),
      decoration: BoxDecoration(
          color: backgroundColor,
          borderRadius: BorderRadius.all(Radius.circular(width??0))
      ),
      child:(!(imgPath??'').startsWith('http'))?
      ClipOval(
        child: ImageUtils.loadAssetImage(
            placeholder,
            width: PxUtils.setSize(width??0),
            height: PxUtils.setSize(height??0),
            fit: BoxFit.fill
        ),
      ):
      ClipOval(
        child: ImageUtils.loadNetworkImage(
            imgPath,
            placeholder: placeholder,
            width: PxUtils.setSize(width??0),
            height: PxUtils.setSize(height??0),
            key: key,
            fit: BoxFit.fill
        ),
      ),
    ):Container(
      margin:margin,
      padding: padding,
      width: PxUtils.setSize(width??0),
      height: PxUtils.setSize(height??0),
      child:(!(imgPath??'').startsWith('http'))?
      ClipRRect(
        borderRadius: BorderRadius.circular(roundRadius),
        child: ImageUtils.loadAssetImage(
            placeholder,
            width: PxUtils.setSize(width??0),
            height: PxUtils.setSize(height??0),
            fit: BoxFit.fill
        ),
      ):
      ClipRRect(
        borderRadius: BorderRadius.circular(roundRadius),
        child: ImageUtils.loadNetworkImage(
            imgPath,
            placeholder: placeholder,
            width: PxUtils.setSize(width??0),
            height: PxUtils.setSize(height??0),
            key: key,
            fit: BoxFit.fill
        ),
      ),
    )
  ;
}