Convert chat to from builder to ListView (#154)

Since widgets are built bottom up in the chat, most of the benefits of
the `ListView.builder` are likely null.
This commit is contained in:
Tommy Chow 2022-07-27 16:17:15 -04:00
parent 9911ed49e6
commit 717d989954

View file

@ -35,16 +35,17 @@ class Chat extends StatelessWidget {
style: DefaultTextStyle.of(context).style.copyWith(fontSize: chatStore.settings.fontSize),
child: Observer(
builder: (context) {
return ListView.builder(
return ListView(
reverse: true,
padding: EdgeInsets.zero,
addAutomaticKeepAlives: false,
controller: chatStore.scrollController,
itemCount: chatStore.renderMessages.length,
itemBuilder: (context, index) => ChatMessage(
ircMessage: chatStore.renderMessages.reversed.toList()[index],
chatStore: chatStore,
),
children: chatStore.renderMessages.reversed
.map((e) => ChatMessage(
ircMessage: e,
chatStore: chatStore,
))
.toList(),
);
},
),