getProfilePhoto method

Widget getProfilePhoto({
  1. required double width,
  2. required double height,
  3. required String profilePhoto,
})

Implementation

Widget getProfilePhoto({required double width, required double height, required String profilePhoto}) {
  if (profilePhoto != "" && profilePhoto != "null") {
    return CircleAvatar(
      radius: 35,
      backgroundColor: Colors.transparent,
      child: ClipRRect(
            borderRadius: BorderRadius.circular(8),
            child: CachedNetworkImage(
              imageUrl: profilePhoto,
              fit: BoxFit.fill,
              // width: width,
              // height: height,
              placeholder: (context, url) => const CircularProgressIndicator(),
              errorWidget: (context, url, error) => Image.asset(
                'assets/images/ic_avatar.png',
              ),
            ),
          ),
    );
  } else {
    return Image.asset(
          'assets/images/ic_avatar.png',
        );
  }
}