You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to set message "sent time" by myself in order to achieve behavior where all the new messages are the last one in chat, like this:
preMessageSending: (m) {
_lastCreatedAt = _messages?.firstOrNull?.createdAt.add(const Duration(milliseconds: 100));
if (m.createdAt.isBefore(_lastCreatedAt ?? DateTime(2000))) {
final newMsg = m.copyWith(
createdAt: _lastCreatedAt,
localCreatedAt: _lastCreatedAt,
);
return newMsg;
}
return m;
},
But created messages seem to ignore attributes createdAt and localCreatedAt. How do I achieve this behaviour with StreamMessageInput widget? (all the new messages should be in the bottom)
Steps to reproduce
1. Go to StreamMessageInput widget provided by library
2. Use preMessageSending attribute and set there required time
3. Newly posted messages will be created with their own "created at" time.
Supporting info to reproduce
No response
Relevant log output
No response
Flutter analyze output
flutter analyze
Analyzing qyre-flutter...
No issues found! (ran in 18.1s)
Flutter doctor output
fvm flutter doctor -v
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22621.2428], locale ru-RU)
• Flutter version 3.13.9 on channel stable at C:\Users\dima\fvm\versions\3.13.6
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d211f42860 (9 days ago), 2023-10-25 13:42:25 -0700
• Engine revision 0545f8705d
• Dart version 3.1.5
• DevTools version 2.25.0
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\sdk\Android\android-sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_HOME = C:\sdk\Android\android-sdk
• Java binary at: C:\Users\dima\Downloads\android-studio-2023.1.1.10-windows\android-studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10353782)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.7.34031.279
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\android-studio-canary
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] Android Studio (version 2023.1)
• Android Studio at C:\Users\dima\Downloads\android-studio-2023.1.1.10-windows\android-studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10353782)
[√] VS Code, 64-bit edition (version 1.82.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.76.0
[√] Connected device (4 available)
• Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2428]
• Chrome (web) • chrome • web-javascript • Google Chrome 118.0.5993.120
• Edge (web) • edge • web-javascript • Microsoft Edge 118.0.2088.76
[√] Network resources
• All expected network resources are available.
• No issues found!
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Where do you declare _lastCreatedAt and _messages? Are they part of a State?
yes, they are, and during the debugging they are set at the moment of message sending. But I would prefer to not declare them at all and will be happy if all new messages will have timestamp that is greater then the latest message in chat (or at least have some kind of flag to enable such behaviour). Right now the issue is that new messages appear BEFORE the latest chat message sometimes (and that happens because for some reason timestamps depend on client side). Will be happy to have an option for stream chat to handle all timestamps and enforce correct message order.
Which packages are you using?
stream_chat_flutter
On what platforms did you experience the issue?
Android
What version are you using?
stream_chat_flutter: ^6.11.0
What happened?
Trying to set message "sent time" by myself in order to achieve behavior where all the new messages are the last one in chat, like this:
But created messages seem to ignore attributes createdAt and localCreatedAt. How do I achieve this behaviour with
StreamMessageInput
widget? (all the new messages should be in the bottom)Steps to reproduce
Supporting info to reproduce
No response
Relevant log output
No response
Flutter analyze output
Flutter doctor output
Code of Conduct
The text was updated successfully, but these errors were encountered: