diff --git a/lib/widgets/file_list_view.dart b/lib/widgets/file_list_view.dart index 446306cc..b8980426 100644 --- a/lib/widgets/file_list_view.dart +++ b/lib/widgets/file_list_view.dart @@ -608,26 +608,30 @@ class FileListView extends HookConsumerWidget { previewWidget = getFileIcon(file, size: 48); break; case 'text': - previewWidget = FutureBuilder( - future: ref - .read(apiClientProvider) - .get(uri) - .then((response) => response.data as String), - builder: - (context, snapshot) => - snapshot.hasData - ? SingleChildScrollView( - child: Text( - snapshot.data!, - style: const TextStyle( - fontSize: 8, - fontFamily: 'monospace', + previewWidget = Container( + color: Theme.of(context).colorScheme.surfaceContainer, + child: FutureBuilder( + future: ref + .read(apiClientProvider) + .get(uri) + .then((response) => response.data as String), + builder: + (context, snapshot) => + snapshot.hasData + ? SingleChildScrollView( + padding: EdgeInsets.all(24), + child: Text( + snapshot.data!, + style: const TextStyle( + fontSize: 9, + fontFamily: 'monospace', + ), + maxLines: 20, + overflow: TextOverflow.ellipsis, ), - maxLines: 20, - overflow: TextOverflow.ellipsis, - ), - ) - : const Center(child: CircularProgressIndicator()), + ) + : const Center(child: CircularProgressIndicator()), + ), ); break; case 'application' when file.mimeType == 'application/pdf': diff --git a/lib/widgets/thought/thought_content.dart b/lib/widgets/thought/thought_content.dart index e09a59db..551f9d9e 100644 --- a/lib/widgets/thought/thought_content.dart +++ b/lib/widgets/thought/thought_content.dart @@ -32,59 +32,36 @@ class ThoughtContent extends StatelessWidget { // Streaming text with spinner if (streamingText.isNotEmpty) { final isStreamingError = streamingText.startsWith('Error:'); - return Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Container( - padding: - isStreamingError - ? const EdgeInsets.all(8) - : EdgeInsets.zero, - decoration: - isStreamingError - ? BoxDecoration( - border: Border.all( - color: Theme.of(context).colorScheme.error, - width: 1, - ), - borderRadius: BorderRadius.circular(8), - ) - : null, - child: MarkdownTextContent( - isSelectable: true, - content: streamingText, - extraBlockSyntaxList: [ProposalBlockSyntax()], - textStyle: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: - isStreamingError - ? Theme.of(context).colorScheme.error - : null, - ), - extraGenerators: [ - ProposalGenerator( - backgroundColor: - Theme.of(context).colorScheme.secondaryContainer, - foregroundColor: - Theme.of(context).colorScheme.onSecondaryContainer, - borderColor: Theme.of(context).colorScheme.outline, + return Container( + padding: isStreamingError ? const EdgeInsets.all(8) : EdgeInsets.zero, + decoration: + isStreamingError + ? BoxDecoration( + border: Border.all( + color: Theme.of(context).colorScheme.error, + width: 1, ), - ], - ), - ), + borderRadius: BorderRadius.circular(8), + ) + : null, + child: MarkdownTextContent( + isSelectable: true, + content: streamingText, + extraBlockSyntaxList: [ProposalBlockSyntax()], + textStyle: Theme.of(context).textTheme.bodyMedium!.copyWith( + color: + isStreamingError ? Theme.of(context).colorScheme.error : null, ), - const SizedBox(width: 8), - SizedBox( - width: 16, - height: 16, - child: CircularProgressIndicator( - strokeWidth: 2, - valueColor: AlwaysStoppedAnimation( - Theme.of(context).colorScheme.primary, - ), + extraGenerators: [ + ProposalGenerator( + backgroundColor: + Theme.of(context).colorScheme.secondaryContainer, + foregroundColor: + Theme.of(context).colorScheme.onSecondaryContainer, + borderColor: Theme.of(context).colorScheme.outline, ), - ), - ], + ], + ), ); } return const SizedBox.shrink(); diff --git a/lib/widgets/thought/thought_shared.dart b/lib/widgets/thought/thought_shared.dart index 8bdfa60b..68735214 100644 --- a/lib/widgets/thought/thought_shared.dart +++ b/lib/widgets/thought/thought_shared.dart @@ -719,10 +719,27 @@ class ThoughtItem extends StatelessWidget { spacing: 8, children: [ // Main content - ThoughtContent( - isStreaming: isStreaming, - streamingText: streamingText, - thought: thought, + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: ThoughtContent( + isStreaming: isStreaming, + streamingText: streamingText, + thought: thought, + ), + ), + if (isStreaming && isAI) + SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator( + strokeWidth: 2.5, + padding: const EdgeInsets.all(4), + ), + ), + ], ), // Reasoning chunks (streaming only) @@ -743,7 +760,10 @@ class ThoughtItem extends StatelessWidget { ), // Token count and model name (for completed AI thoughts only) - if (!isStreaming && isAI && thought != null) + if (!isStreaming && + isAI && + thought != null && + !thought!.id.startsWith('error-')) TokenInfo(thought: thought!), // Proposals (for completed AI thoughts only) @@ -752,8 +772,6 @@ class ThoughtItem extends StatelessWidget { proposals: proposals, onProposalAction: _handleProposalAction, ), - - if (isStreaming && isAI) LinearProgressIndicator(), ], ), ),