feat(chat): Improve text color and segment spacing in UI components

This commit is contained in:
cogwheel0
2025-12-07 23:47:40 +05:30
parent 03c2b030e1
commit dcca839e35
3 changed files with 21 additions and 11 deletions

View File

@@ -420,7 +420,7 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
? Icons.keyboard_arrow_up_rounded ? Icons.keyboard_arrow_up_rounded
: Icons.keyboard_arrow_down_rounded, : Icons.keyboard_arrow_down_rounded,
size: 14, size: 14,
color: theme.textSecondary, color: theme.textPrimary.withValues(alpha: 0.8),
), ),
const SizedBox(width: 2), const SizedBox(width: 2),
Flexible( Flexible(
@@ -429,7 +429,7 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: AppTypography.bodySmall, fontSize: AppTypography.bodySmall,
color: theme.textSecondary, color: theme.textPrimary.withValues(alpha: 0.8),
height: 1.3, height: 1.3,
), ),
), ),
@@ -518,6 +518,7 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
Widget _buildSegmentedContent() { Widget _buildSegmentedContent() {
final children = <Widget>[]; final children = <Widget>[];
bool firstToolSpacerAdded = false; bool firstToolSpacerAdded = false;
bool hasNonTextSegment = false;
int idx = 0; int idx = 0;
for (final seg in _segments) { for (final seg in _segments) {
if (seg.isTool && seg.toolCall != null) { if (seg.isTool && seg.toolCall != null) {
@@ -527,9 +528,16 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
firstToolSpacerAdded = true; firstToolSpacerAdded = true;
} }
children.add(_buildToolCallTile(seg.toolCall!)); children.add(_buildToolCallTile(seg.toolCall!));
hasNonTextSegment = true;
} else if (seg.isReasoning && seg.reasoning != null) { } else if (seg.isReasoning && seg.reasoning != null) {
children.add(_buildReasoningTile(seg.reasoning!, idx)); children.add(_buildReasoningTile(seg.reasoning!, idx));
hasNonTextSegment = true;
} else if ((seg.text ?? '').trim().isNotEmpty) { } else if ((seg.text ?? '').trim().isNotEmpty) {
// Add spacing before text content if it follows non-text segments
if (hasNonTextSegment) {
children.add(const SizedBox(height: Spacing.sm));
hasNonTextSegment = false;
}
children.add(_buildEnhancedMarkdownContent(seg.text!)); children.add(_buildEnhancedMarkdownContent(seg.text!));
} }
idx++; idx++;
@@ -1342,7 +1350,7 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
? Icons.keyboard_arrow_up_rounded ? Icons.keyboard_arrow_up_rounded
: Icons.keyboard_arrow_down_rounded, : Icons.keyboard_arrow_down_rounded,
size: 14, size: 14,
color: theme.textSecondary, color: theme.textPrimary.withValues(alpha: 0.8),
), ),
const SizedBox(width: 2), const SizedBox(width: 2),
Flexible( Flexible(
@@ -1351,7 +1359,7 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: AppTypography.bodySmall, fontSize: AppTypography.bodySmall,
color: theme.textSecondary, color: theme.textPrimary.withValues(alpha: 0.8),
height: 1.3, height: 1.3,
), ),
), ),

View File

@@ -68,8 +68,8 @@ class _OpenWebUISourcesWidgetState extends State<OpenWebUISourcesWidget> {
splashColor: theme.surfaceContainer.withValues(alpha: 0.2), splashColor: theme.surfaceContainer.withValues(alpha: 0.2),
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 14, horizontal: 10,
vertical: 8, vertical: 5,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),

View File

@@ -137,7 +137,7 @@ class _MinimalStatusRow extends StatelessWidget {
? Icons.keyboard_arrow_up_rounded ? Icons.keyboard_arrow_up_rounded
: Icons.keyboard_arrow_down_rounded, : Icons.keyboard_arrow_down_rounded,
size: 14, size: 14,
color: theme.textSecondary, color: theme.textPrimary.withValues(alpha: 0.8),
), ),
const SizedBox(width: 2), const SizedBox(width: 2),
], ],
@@ -166,9 +166,10 @@ class _MinimalStatusRow extends StatelessWidget {
bool isPending, bool isPending,
) { ) {
final theme = context.conduitTheme; final theme = context.conduitTheme;
final baseColor = theme.textPrimary.withValues(alpha: 0.8);
final baseStyle = TextStyle( final baseStyle = TextStyle(
fontSize: AppTypography.bodySmall, fontSize: AppTypography.bodySmall,
color: theme.textSecondary, color: baseColor,
height: 1.3, height: 1.3,
); );
@@ -184,7 +185,7 @@ class _MinimalStatusRow extends StatelessWidget {
return Text( return Text(
description, description,
style: baseStyle.copyWith( style: baseStyle.copyWith(
color: theme.textSecondary.withValues(alpha: opacity), color: baseColor.withValues(alpha: opacity),
), ),
maxLines: 1, maxLines: 1,
); );
@@ -288,9 +289,10 @@ class _MinimalHistoryTimeline extends StatelessWidget {
bool isPending, bool isPending,
) { ) {
final theme = context.conduitTheme; final theme = context.conduitTheme;
final baseColor = theme.textPrimary.withValues(alpha: 0.8);
final baseStyle = TextStyle( final baseStyle = TextStyle(
fontSize: AppTypography.bodySmall, fontSize: AppTypography.bodySmall,
color: theme.textSecondary, color: baseColor,
height: 1.3, height: 1.3,
); );
@@ -305,7 +307,7 @@ class _MinimalHistoryTimeline extends StatelessWidget {
return Text( return Text(
description, description,
style: baseStyle.copyWith( style: baseStyle.copyWith(
color: theme.textSecondary.withValues(alpha: opacity), color: baseColor.withValues(alpha: opacity),
), ),
); );
}, },