|
|
|
@ -78,8 +78,17 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
|
|
|
|
|
messages = await hxDatabase.queryUList(_toUser.mid, pageSize: 100); |
|
|
|
|
|
|
|
|
|
socketClient.addCallback(_toUser.mid, (Message message) { |
|
|
|
|
messages.add(message); |
|
|
|
|
messages.insert(0, message); |
|
|
|
|
refreshState(); |
|
|
|
|
|
|
|
|
|
if (scrollController.position != null) { |
|
|
|
|
double offset = scrollController.position.maxScrollExtent; |
|
|
|
|
debugPrint("offset: $offset"); |
|
|
|
|
Future.delayed(const Duration(milliseconds: 500), () { |
|
|
|
|
scrollController.animateTo(offset + 108, duration: const Duration(milliseconds: 500), curve: Curves.easeIn); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
refreshState(); |
|
|
|
|
|
|
|
|
@ -820,7 +829,9 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
|
|
|
|
|
if (scrollController.position != null) { |
|
|
|
|
double offset = scrollController.position.maxScrollExtent; |
|
|
|
|
debugPrint("offset: $offset"); |
|
|
|
|
scrollController.animateTo(offset + 50, duration: const Duration(milliseconds: 500), curve: Curves.easeIn); |
|
|
|
|
Future.delayed(const Duration(milliseconds: 500), () { |
|
|
|
|
scrollController.animateTo(offset + 108, duration: const Duration(milliseconds: 500), curve: Curves.easeIn); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|