feat: enhance markdown image handling with customizable builder
- Introduced an `imageBuilderOverride` parameter in the `ConduitMarkdown` class to allow customization of how markdown images are rendered. - Updated the `StreamingMarkdownWidget` to accept the new `imageBuilderOverride` parameter, enabling enhanced image handling in streaming contexts. - Implemented an `imageBuilderOverride` in the `_AssistantMessageWidgetState` to utilize `EnhancedImageAttachment`, providing caching, authentication headers, and fullscreen viewing for markdown images. - Refactored the `_ImageBuilder` class to support the new image building logic, improving flexibility and maintainability of image rendering in markdown content.
This commit is contained in:
@@ -13,11 +13,14 @@ class StreamingMarkdownWidget extends StatelessWidget {
|
||||
required this.content,
|
||||
required this.isStreaming,
|
||||
this.onTapLink,
|
||||
this.imageBuilderOverride,
|
||||
});
|
||||
|
||||
final String content;
|
||||
final bool isStreaming;
|
||||
final MarkdownLinkTapCallback? onTapLink;
|
||||
final Widget Function(Uri uri, String? title, String? alt)?
|
||||
imageBuilderOverride;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -34,6 +37,7 @@ class StreamingMarkdownWidget extends StatelessWidget {
|
||||
data: data,
|
||||
onTapLink: onTapLink,
|
||||
selectable: false,
|
||||
imageBuilderOverride: imageBuilderOverride,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user