dash_chat
dash_chat copied to clipboard
Separating messages with the same date
Describe the bug Messages with the same date are being separated.
Expected behavior Messages should be in the same block if date is the same.
Screenshots
Desktop (please complete the following information):
- OS: Ubuntu 20.04
- Device: SM A605GN
- Flutter Version: 1.17.2
- Dart Version: 2.8.4 (stable)
- Version 1.1.13
For this, Temporarily you can use mine forked version, Since I had set the time difference to consider hours and minutes as well . But I will be soon making PR for this issue. So that we can both use the original dash_chat with this feature on
dash_chat: git: https://github.com/sijangurung/dash_chat.git
Is this related to #47 ?
For my usecase, since if (currentDate == null) { currentDate = DateTime(widget.messages[i].createdAt.year, widget.messages[i].createdAt.month, widget.messages[i].createdAt.day) uses only month, year and day , I need to separate the messages in hours and show date-label.
I have same situation and when it happened, this message show up in a debug console.
════════ Exception caught by rendering library ═════════════════════════════════ Build scheduled during frame. The relevant error-causing widget was DashChat-[LabeledGlobalKey<DashChatState>#e2ef9] ═════════════════════════════════════════════════════════════════
Are there any solutions?
@sijangurung this is done like that on purpose, otherwise currentDate.difference(messageDate).inDays != 0
wont work when there is not more than 24hours of difference even though it's not the same day
@fluttercid or @mateus96mt can you provide a project repository to reproduce the issue?
@SebastienBtr I understand that . So since i needed to group 1hour difference messages, I had made a quick fix in my repo. Forked repo:: 👇👇👇👇==============================================👇👇👇👇👇 https://github.com/sijangurung/dash_chat.git on pubspec.yaml , just use:
dash_chat: git: https://github.com/sijangurung/dash_chat.git
@sijangurung okay I checked your code quickly but what you did is not really related to this issue and wont be merge as it is because it'll break the usage for everyone who want to have it by day and not hours. However, I'll create a feature request to add a date separator frequency param. A v2 of Dash Chat will be soon started, so this issue as well as the other issues and feature requests are going to be solved/added in the V2.