Reuse chat table cell measurements across rebuilds
A markdown table measures each cell's paragraph at infinite width before laying it out. Cells rebuilt when a row scrolls back in or a chat is opened again now reuse those widths from a bounded cache keyed by the cell markdown and its paragraph style, cleared when fonts change. Layout is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import 'chat_markdown_cache.dart';
|
||||
import 'chat_markdown_speech.dart';
|
||||
import 'chat_message_bubble.dart';
|
||||
import '../../speech/speech.dart';
|
||||
import 'chat_table_cell_measure.dart';
|
||||
import 'chat_table_column_width.dart';
|
||||
|
||||
/// Renders one assistant text part with native text widgets and the host's own
|
||||
@@ -305,7 +306,10 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
role: header ? SemanticsRole.columnHeader : null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: _text(context, text, style: style),
|
||||
child: ChatTableCellMeasure(
|
||||
source: text,
|
||||
child: _text(context, text, style: style),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user