bubbleBuilder method
Implementation
@override
Widget bubbleBuilder(
BuildContext context,
Message message,
MessageRenderContext ctx,
) {
final p = message.payload as ContactPayload;
return GestureDetector(
onTap: ctx.onTap,
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: const Color(0x0D000000),
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
CircleAvatar(
radius: 22,
backgroundImage: p.avatarUrl != null
? NetworkImage(p.avatarUrl!)
: null,
backgroundColor: const Color(0x3325D366),
child: p.avatarUrl == null
? Text(
p.name.substring(0, 1).toUpperCase(),
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 16),
)
: null,
),
const SizedBox(width: 10),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
p.name,
style: const TextStyle(
fontWeight: FontWeight.w600, fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
if (p.phone != null)
Text(
p.phone!,
style: const TextStyle(
fontSize: 12, color: Colors.grey),
),
],
),
),
const SizedBox(width: 8),
TextButton(
onPressed: ctx.onTap,
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 10),
minimumSize: Size.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: const Text('Add',
style: TextStyle(color: Color(0xFF25D366))),
),
],
),
),
);
}