bubbleBuilder method
Implementation
@override
Widget bubbleBuilder(
BuildContext context,
Message message,
MessageRenderContext ctx,
) {
final p = message.payload as LocationPayload;
// Static map thumbnail via OpenStreetMap tiles
final tileUrl =
'https://staticmap.openstreetmap.de/staticmap.php'
'?center=${p.latitude},${p.longitude}'
'&zoom=14&size=300x160&maptype=mapnik'
'&markers=${p.latitude},${p.longitude},red-pushpin';
return GestureDetector(
onTap: ctx.onTap,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.network(
tileUrl,
width: 240,
height: 140,
fit: BoxFit.cover,
errorBuilder: (_, __, ___) => Container(
width: 240,
height: 140,
color: Colors.grey.shade200,
alignment: Alignment.center,
child: const Icon(Icons.map_rounded,
size: 48, color: Colors.grey),
),
),
),
const SizedBox(height: 6),
Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.location_on_rounded,
size: 14, color: Colors.red),
const SizedBox(width: 4),
Flexible(
child: Text(
p.label ?? p.address ?? 'Shared location',
style: DefaultTextStyle.of(context)
.style
.copyWith(fontSize: 13),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
],
),
);
}