Only show messages in room view
This commit is contained in:
parent
1376580e7e
commit
ea7587fe2d
|
@ -42,24 +42,30 @@ class _RoomPageState extends State<RoomPage> {
|
|||
|
||||
void sendMessage() {}
|
||||
|
||||
List<Event>? get messages => timeline?.events
|
||||
.where((element) => element.type == EventTypes.Message)
|
||||
.toList();
|
||||
|
||||
List<Widget> getChildren() {
|
||||
if (timeline == null) return [const CircularProgressIndicator()];
|
||||
return [
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: timeline?.events.length,
|
||||
itemCount: messages?.length,
|
||||
reverse: true,
|
||||
itemBuilder: (context, index) => ListTile(
|
||||
title: Text(timeline!
|
||||
.events[index].senderFromMemoryOrFallback.displayName
|
||||
title: Text(messages![index]
|
||||
.senderFromMemoryOrFallback
|
||||
.displayName
|
||||
.toString()),
|
||||
subtitle: Text(timeline!.events[index].body),
|
||||
leading: timeline?.events[index].senderFromMemoryOrFallback
|
||||
.avatarUrl !=
|
||||
subtitle: Text(messages![index].body),
|
||||
leading:
|
||||
messages![index].senderFromMemoryOrFallback.avatarUrl !=
|
||||
null
|
||||
? CircleAvatar(
|
||||
foregroundImage: NetworkImage(timeline!.events[index]
|
||||
.senderFromMemoryOrFallback.avatarUrl!
|
||||
foregroundImage: NetworkImage(messages![index]
|
||||
.senderFromMemoryOrFallback
|
||||
.avatarUrl!
|
||||
.getThumbnail(widget.room.client,
|
||||
width: 50, height: 50)
|
||||
.toString()))
|
||||
|
|
Loading…
Reference in New Issue
Block a user