fix: UX feedback for sending events
This commit is contained in:
parent
052c9065b8
commit
3e01544a75
3 changed files with 182 additions and 145 deletions
|
|
@ -463,14 +463,17 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
scrollUpBannerEventId = eventId;
|
||||
});
|
||||
|
||||
bool firstUpdateReceived = false;
|
||||
String? animateInEventId;
|
||||
|
||||
void _insert(int index) {
|
||||
if (index > 0) return;
|
||||
animateInEventId = timeline?.events.firstOrNull?.eventId;
|
||||
}
|
||||
|
||||
void updateView() {
|
||||
if (!mounted) return;
|
||||
setReadMarker();
|
||||
setState(() {
|
||||
firstUpdateReceived = true;
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Future<void>? loadTimelineFuture;
|
||||
|
|
@ -487,6 +490,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
timeline?.cancelSubscriptions();
|
||||
timeline = await room.getTimeline(
|
||||
onUpdate: updateView,
|
||||
onInsert: _insert,
|
||||
eventContextId: eventContextId,
|
||||
);
|
||||
} catch (e, s) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue