From df8cffeafe1bd3795e217ef2b573c7d6efc18a2a Mon Sep 17 00:00:00 2001 From: NC1107 Date: Thu, 21 May 2026 23:35:07 -0400 Subject: [PATCH] perf(client): widen chat list cacheExtent so fast scrolling stops flashing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The chat ListView used Flutter's default cacheExtent of 250px, which is too tight for messages that include images, reactions, and reply quotes — each takes a frame to lay out, so momentum scrolling on long histories briefly showed blank space before items mounted. Bumped to 600px (about one viewport) so the visible window stays warm during fast scrolling. --- .../lib/src/widgets/chat_panel/chat_message_list.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/client/lib/src/widgets/chat_panel/chat_message_list.dart b/apps/client/lib/src/widgets/chat_panel/chat_message_list.dart index 036bbc2d..b6ec5035 100644 --- a/apps/client/lib/src/widgets/chat_panel/chat_message_list.dart +++ b/apps/client/lib/src/widgets/chat_panel/chat_message_list.dart @@ -252,6 +252,12 @@ class ChatMessageList extends ConsumerWidget { child: ListView.builder( controller: scrollController, padding: const EdgeInsets.only(bottom: 16), + // Pre-build ~one viewport of off-screen messages on each side so that + // momentum scrolling doesn't flash blank space while items mount. The + // Flutter default of 250 is too tight for chat where rows include + // images, reactions, and reply quotes that each take a frame to lay + // out. Tuned conservatively to keep memory in check on long histories. + cacheExtent: 600, itemCount: messages.length + 1, itemBuilder: (context, index) { if (index == 0) {