ProfilePhoto function
Widget
ProfilePhoto(
- BuildContext context, [
- String? pfp,
- double size = ProfileSize.md,
- bool isGroup = false,
Implementation
Widget ProfilePhoto (BuildContext context, [String? pfp, double size = ProfileSize.md, bool isGroup = false ] ){
return Container(
alignment: Alignment.center,
height: size,
width: size,
decoration: BoxDecoration(
border: isGroup ? Border.all(color: ThemeColor.bg) : null,
color: ThemeColor.bgSecondary,
shape: BoxShape.circle,
// IF the pfp is not null, display picture
image: pfp == null ? null : DecorationImage(
image: FileImage(File(pfp)),
fit: BoxFit.cover,
),
),
// IF the pfp is null, or a group icon, display preset
child: pfp == null || isGroup ? SvgPicture.asset(
height: _getIconSize(size),
width: _getIconSize(size),
isGroup ? ThemeIcon.group : ThemeIcon.profile,
colorFilter: const ColorFilter.mode(ThemeColor.textSecondary, BlendMode.srcIn),
) : null,
);
}