Only show messages in room view

This commit is contained in:
Brandon Presley 2023-12-29 17:19:40 +13:00
parent 1376580e7e
commit ea7587fe2d

View File

@ -42,28 +42,34 @@ class _RoomPageState extends State<RoomPage> {
void sendMessage() {} void sendMessage() {}
List<Event>? get messages => timeline?.events
.where((element) => element.type == EventTypes.Message)
.toList();
List<Widget> getChildren() { List<Widget> getChildren() {
if (timeline == null) return [const CircularProgressIndicator()]; if (timeline == null) return [const CircularProgressIndicator()];
return [ return [
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: timeline?.events.length, itemCount: messages?.length,
reverse: true, reverse: true,
itemBuilder: (context, index) => ListTile( itemBuilder: (context, index) => ListTile(
title: Text(timeline! title: Text(messages![index]
.events[index].senderFromMemoryOrFallback.displayName .senderFromMemoryOrFallback
.displayName
.toString()), .toString()),
subtitle: Text(timeline!.events[index].body), subtitle: Text(messages![index].body),
leading: timeline?.events[index].senderFromMemoryOrFallback leading:
.avatarUrl != messages![index].senderFromMemoryOrFallback.avatarUrl !=
null null
? CircleAvatar( ? CircleAvatar(
foregroundImage: NetworkImage(timeline!.events[index] foregroundImage: NetworkImage(messages![index]
.senderFromMemoryOrFallback.avatarUrl! .senderFromMemoryOrFallback
.getThumbnail(widget.room.client, .avatarUrl!
width: 50, height: 50) .getThumbnail(widget.room.client,
.toString())) width: 50, height: 50)
: null, .toString()))
: null,
)), )),
), ),
TextFormField( TextFormField(