build method
Implementation
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 6, 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/// Avatar
Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: CircleAvatar(
backgroundColor: Colors.black38,
radius: 36,
child: Text(
_initials(name, email).toUpperCase(),
style: TextStyle(
color: foreground,
fontSize: 32,
fontWeight: FontWeight.bold,
),
),
),
),
/// Edit Button
if (menuItems != null && onMenuSelect != null)
PopupMenuButton<O>(
icon: FaIcon(
FontAwesomeIcons.solidPenToSquare,
color: foreground,
size: 14,
),
itemBuilder: (BuildContext context) => menuItems!
.map((PopupIconMenuItem<O> item) => item.widget)
.toList(),
onSelected: (O operation) => onMenuSelect!(operation),
),
],
),
/// Name
Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 4),
child: Icon(
FontAwesomeIcons.solidUser,
color: foreground,
size: 14,
),
),
Expanded(
child: Text(
name,
style:
Theme.of(context).primaryTextTheme.bodyLarge?.copyWith(
color: foreground,
),
overflow: TextOverflow.ellipsis,
),
),
],
),
),
/// Email
Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 4),
child: Icon(
FontAwesomeIcons.solidEnvelope,
color: foreground,
size: 14,
),
),
Expanded(
child: Text(
email,
style:
Theme.of(context).primaryTextTheme.bodyMedium?.copyWith(
color: foreground,
),
overflow: TextOverflow.ellipsis,
),
),
if (expandable && companyName.isEmpty)
Padding(
padding: const EdgeInsets.only(right: 10),
child: ExpandableIcon(),
),
],
),
),
/// Company Name
if (companyName.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 4),
child: Icon(
FontAwesomeIcons.building,
color: foreground,
size: 14,
),
),
Expanded(
child: Text(
companyName,
style: Theme.of(context)
.primaryTextTheme
.bodyMedium
?.copyWith(
color: foreground,
),
overflow: TextOverflow.ellipsis,
),
),
if (expandable)
Padding(
padding: const EdgeInsets.only(right: 10),
child: ExpandableIcon(),
),
],
),
),
],
),
);
}