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() {}
|
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
|
||||||
|
.avatarUrl!
|
||||||
.getThumbnail(widget.room.client,
|
.getThumbnail(widget.room.client,
|
||||||
width: 50, height: 50)
|
width: 50, height: 50)
|
||||||
.toString()))
|
.toString()))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user