refactor: message sending ux
This commit is contained in:
@@ -825,21 +825,12 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
|
|||||||
children: [
|
children: [
|
||||||
// Increase spacing between assistant name and typing indicator
|
// Increase spacing between assistant name and typing indicator
|
||||||
const SizedBox(height: Spacing.md),
|
const SizedBox(height: Spacing.md),
|
||||||
// Give the dots breathing room to avoid any clip from transitions
|
// Give the indicator breathing room to avoid any clip from transitions
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 4, bottom: 4),
|
padding: const EdgeInsets.only(left: 4, bottom: 4),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 14,
|
height: 14,
|
||||||
child: Row(
|
child: _buildTypingDot(),
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
_buildTypingDot(0),
|
|
||||||
const SizedBox(width: Spacing.xs),
|
|
||||||
_buildTypingDot(200),
|
|
||||||
const SizedBox(width: Spacing.xs),
|
|
||||||
_buildTypingDot(400),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -848,26 +839,29 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTypingDot(int delay) {
|
Widget _buildTypingDot() {
|
||||||
|
final min = AnimationValues.typingIndicatorScale;
|
||||||
return Container(
|
return Container(
|
||||||
width: 10,
|
width: 10,
|
||||||
height: 10,
|
height: 10,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: context.conduitTheme.textSecondary.withValues(alpha: 0.6),
|
color: context.conduitTheme.textSecondary.withValues(alpha: 0.6),
|
||||||
borderRadius: BorderRadius.circular(AppBorderRadius.xs),
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.animate(onPlay: (controller) => controller.repeat())
|
.animate(onPlay: (controller) => controller.repeat())
|
||||||
.scale(
|
.scale(
|
||||||
duration: const Duration(milliseconds: 1000),
|
duration: AnimationDuration.typingIndicator,
|
||||||
begin: const Offset(1, 1),
|
curve: AnimationCurves.typingIndicator,
|
||||||
end: const Offset(1.25, 1.25),
|
begin: Offset(min, min),
|
||||||
)
|
|
||||||
.then(delay: Duration(milliseconds: delay))
|
|
||||||
.scale(
|
|
||||||
duration: const Duration(milliseconds: 1000),
|
|
||||||
begin: const Offset(1.25, 1.25),
|
|
||||||
end: const Offset(1, 1),
|
end: const Offset(1, 1),
|
||||||
|
)
|
||||||
|
.then(delay: AnimationDelay.typingDelay)
|
||||||
|
.scale(
|
||||||
|
duration: AnimationDuration.typingIndicator,
|
||||||
|
curve: AnimationCurves.typingIndicator,
|
||||||
|
begin: const Offset(1, 1),
|
||||||
|
end: Offset(min, min),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -323,10 +323,12 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
|||||||
PlatformUtils.lightHaptic();
|
PlatformUtils.lightHaptic();
|
||||||
widget.onSendMessage(text);
|
widget.onSendMessage(text);
|
||||||
_controller.clear();
|
_controller.clear();
|
||||||
// Keep tools and web search enabled for the conversation
|
// After sending, dismiss keyboard and collapse input
|
||||||
// Keep input expanded and focused for better UX - don't dismiss keyboard
|
if (_focusNode.hasFocus) {
|
||||||
// KeyboardUtils.dismissKeyboard(context);
|
_focusNode.unfocus();
|
||||||
// _setExpanded(false);
|
}
|
||||||
|
// Ensure UI reflects empty state and collapses
|
||||||
|
_setExpanded(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setExpanded(bool expanded) {
|
void _setExpanded(bool expanded) {
|
||||||
|
|||||||
Reference in New Issue
Block a user