Merge branch 'soru/fix-load-member-in-timeline' into 'main'

fix: Properly re-render the timeline etc. when the full userinformation was fetched

See merge request famedly/fluffychat!500
This commit is contained in:
Krille Fear 2021-09-06 18:25:53 +00:00
commit 6d5e06a723

View File

@ -63,7 +63,10 @@ class ChatView extends StatelessWidget {
redirector.stopRedirection();
}
},
child: Scaffold(
child: StreamBuilder(
stream: controller.room.onUpdate.stream
.rateLimit(Duration(milliseconds: 250)),
builder: (context, snapshot) => Scaffold(
appBar: AppBar(
actionsIconTheme: IconThemeData(
color: controller.selectedEvents.isEmpty
@ -80,12 +83,9 @@ class ChatView extends StatelessWidget {
: UnreadBadgeBackButton(roomId: controller.roomId),
titleSpacing: 0,
title: controller.selectedEvents.isEmpty
? StreamBuilder(
stream: controller.room.onUpdate.stream
.rateLimit(Duration(milliseconds: 250)),
builder: (context, snapshot) => ListTile(
leading: Avatar(controller.room.avatar,
controller.room.displayname),
? ListTile(
leading: Avatar(
controller.room.avatar, controller.room.displayname),
contentPadding: EdgeInsets.zero,
onTap: controller.room.isDirectChat
? () => showModalBottomSheet(
@ -118,17 +118,15 @@ class ChatView extends StatelessWidget {
controller.room.directChatMatrixID)
.rateLimit(Duration(seconds: 1)),
builder: (context, snapshot) => Text(
controller.room
.getLocalizedStatus(context),
controller.room.getLocalizedStatus(context),
maxLines: 1,
//overflow: TextOverflow.ellipsis,
))
: Row(
children: <Widget>[
Icon(Icons.edit_outlined,
color: Theme.of(context)
.colorScheme
.secondary,
color:
Theme.of(context).colorScheme.secondary,
size: 13),
SizedBox(width: 4),
Expanded(
@ -137,16 +135,15 @@ class ChatView extends StatelessWidget {
.getLocalizedTypingText(context),
maxLines: 1,
style: TextStyle(
color: Theme.of(context)
.colorScheme
.secondary,
color:
Theme.of(context).colorScheme.secondary,
fontStyle: FontStyle.italic,
),
),
),
],
),
))
)
: Text(controller.selectedEvents.length.toString()),
actions: controller.selectMode
? <Widget>[
@ -261,6 +258,13 @@ class ChatView extends StatelessWidget {
thisEventsKeyMap[
controller.filteredEvents[i].eventId] = i;
}
final seenByText =
controller.room.getLocalizedSeenByText(
context,
controller.timeline,
controller.filteredEvents,
controller.unfolded,
);
return ListView.custom(
padding: EdgeInsets.only(
@ -296,33 +300,15 @@ class ChatView extends StatelessWidget {
)
: Container()
: i == 0
? StreamBuilder(
stream: controller
.room.onUpdate.stream
.rateLimit(Duration(
milliseconds: 250)),
builder: (_, __) {
final seenByText = controller.room
.getLocalizedSeenByText(
context,
controller.timeline,
controller.filteredEvents,
controller.unfolded,
);
return AnimatedContainer(
height:
seenByText.isEmpty ? 0 : 24,
? AnimatedContainer(
height: seenByText.isEmpty ? 0 : 24,
duration: seenByText.isEmpty
? Duration(milliseconds: 0)
: Duration(
milliseconds: 300),
alignment: controller
.filteredEvents
: Duration(milliseconds: 300),
alignment: controller.filteredEvents
.isNotEmpty &&
controller
.filteredEvents
.first
.senderId ==
controller.filteredEvents
.first.senderId ==
client.userID
? Alignment.topRight
: Alignment.topLeft,
@ -339,14 +325,12 @@ class ChatView extends StatelessWidget {
.scaffoldBackgroundColor
.withOpacity(0.8),
borderRadius:
BorderRadius.circular(
4),
BorderRadius.circular(4),
),
child: Text(
seenByText,
maxLines: 1,
overflow:
TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Theme.of(context)
.colorScheme
@ -354,8 +338,6 @@ class ChatView extends StatelessWidget {
),
),
),
);
},
)
: AutoScrollTag(
key: ValueKey(controller
@ -773,7 +755,9 @@ class ChatView extends StatelessWidget {
),
],
),
));
),
),
);
}
}