refactor: wrap chat bubble content in IntrinsicWidth to prevent unnecessary stretching for short messages

This commit is contained in:
pradeepkumar
2026-04-20 09:18:58 +05:30
parent dea688194f
commit 0a11d61a6c

View File

@@ -480,8 +480,12 @@ class _SupportChatScreenState extends ConsumerState<SupportChatScreen> {
color: AppColors.primaryDark.withValues(alpha: 0.1),
),
),
// IntrinsicWidth shrinks the bubble to the widest child (content or
// time), so short messages like "hi" don't stretch to maxWidth.
child: IntrinsicWidth(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (!isOwn)
const Padding(
@@ -522,6 +526,7 @@ class _SupportChatScreenState extends ConsumerState<SupportChatScreen> {
],
),
),
),
);
}