bubbleBuilder method

  1. @override
Widget bubbleBuilder(
  1. BuildContext context,
  2. Message message,
  3. MessageRenderContext ctx
)
override

Implementation

@override
Widget bubbleBuilder(BuildContext context, Message message,
    MessageRenderContext ctx) {
  final p = message.payload as FilePayload;
  return GestureDetector(
    onTap: ctx.onTap,
    child: Container(
      padding: const EdgeInsets.all(10),
      decoration: BoxDecoration(
        color: const Color(0x0F000000),
        borderRadius: BorderRadius.circular(10),
      ),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          Container(
            width: 42,
            height: 42,
            decoration: BoxDecoration(
              color: const Color(0x2625D366),
              borderRadius: BorderRadius.circular(8),
            ),
            child: Icon(
              _iconForMime(p.mimeType),
              color: const Color(0xFF25D366),
              size: 24,
            ),
          ),
          const SizedBox(width: 10),
          Flexible(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.min,
              children: [
                Text(
                  p.filename,
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: DefaultTextStyle.of(context)
                      .style
                      .copyWith(fontWeight: FontWeight.w600, fontSize: 14),
                ),
                if (p.fileSizeBytes != null)
                  Text(
                    _formatSize(p.fileSizeBytes!),
                    style: const TextStyle(fontSize: 11, color: Colors.grey),
                  ),
              ],
            ),
          ),
          const SizedBox(width: 8),
          const Icon(Icons.download_rounded, color: Colors.grey, size: 20),
        ],
      ),
    ),
  );
}