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}) {
  return profilePhoto != "" && profilePhoto != "null"
      ? 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',
            ),
          ),
        )
      : Image.asset(
          'assets/images/ic_avatar.png',
        );
}