import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:pshared/utils/name_initials.dart'; class EmployeeAvatar extends StatelessWidget { final String? avatarUrl; final String employeeName; final double? radius; const EmployeeAvatar({ super.key, this.avatarUrl, required this.employeeName, this.radius, }); @override Widget build(BuildContext context) => CircleAvatar( radius: radius, backgroundColor: Theme.of(context).colorScheme.primary.withAlpha(26), backgroundImage: avatarUrl != null ? CachedNetworkImageProvider(avatarUrl!) : null, child: avatarUrl == null ? Text(getNameInitials(employeeName), style: Theme.of(context).textTheme.bodyMedium) : null, ); }