feat(chat): Optimize chat input and message bubble rendering
This commit is contained in:
@@ -1340,9 +1340,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
|||||||
// For compact mode, render text field shell with floating buttons on sides
|
// For compact mode, render text field shell with floating buttons on sides
|
||||||
if (showCompactComposer) {
|
if (showCompactComposer) {
|
||||||
// Build the text field shell
|
// Build the text field shell
|
||||||
Widget textFieldShell = AnimatedContainer(
|
Widget textFieldShell = Container(
|
||||||
duration: const Duration(milliseconds: 180),
|
|
||||||
curve: Curves.easeOutCubic,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: Spacing.md),
|
padding: const EdgeInsets.symmetric(horizontal: Spacing.md),
|
||||||
constraints: const BoxConstraints(minHeight: TouchTarget.input),
|
constraints: const BoxConstraints(minHeight: TouchTarget.input),
|
||||||
decoration: shellDecoration,
|
decoration: shellDecoration,
|
||||||
@@ -1404,9 +1402,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For expanded mode with quick pills, use the full shell
|
// For expanded mode with quick pills, use the full shell
|
||||||
Widget shell = AnimatedContainer(
|
Widget shell = Container(
|
||||||
duration: const Duration(milliseconds: 180),
|
|
||||||
curve: Curves.easeOutCubic,
|
|
||||||
decoration: shellDecoration,
|
decoration: shellDecoration,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
|
|||||||
@@ -498,6 +498,12 @@ class _UserMessageBubbleState extends ConsumerState<UserMessageBubble> {
|
|||||||
final inlineEditFill = context.conduitTheme.surfaceContainer.withValues(
|
final inlineEditFill = context.conduitTheme.surfaceContainer.withValues(
|
||||||
alpha: 0.92,
|
alpha: 0.92,
|
||||||
);
|
);
|
||||||
|
// Use rounded rectangle for multiline, pill for single-line (like chat input)
|
||||||
|
// Consider multiline if text exceeds ~50 chars or contains newlines
|
||||||
|
// Check length first (O(1)) to short-circuit before scanning for newlines
|
||||||
|
final content = widget.message.content;
|
||||||
|
final isMultiline = content.length > 50 || content.contains('\n');
|
||||||
|
final bubbleRadius = isMultiline ? AppBorderRadius.xl : AppBorderRadius.pill;
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onLongPress: () => _showMessageMenu(context),
|
onLongPress: () => _showMessageMenu(context),
|
||||||
@@ -539,9 +545,7 @@ class _UserMessageBubbleState extends ConsumerState<UserMessageBubble> {
|
|||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: context.conduitTheme.chatBubbleUser,
|
color: context.conduitTheme.chatBubbleUser,
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(bubbleRadius),
|
||||||
AppBorderRadius.messageBubble,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: _isEditing
|
child: _isEditing
|
||||||
? Focus(
|
? Focus(
|
||||||
|
|||||||
Reference in New Issue
Block a user