dash_chat icon indicating copy to clipboard operation
dash_chat copied to clipboard

Separating messages with the same date

Open mateus96mt opened this issue 4 years ago • 8 comments

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 aS

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

mateus96mt avatar Jul 27 '20 21:07 mateus96mt

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

sijangurung avatar Jul 28 '20 09:07 sijangurung

Is this related to #47 ?

SebastienBtr avatar Jul 29 '20 21:07 SebastienBtr

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.

sijangurung avatar Jul 30 '20 09:07 sijangurung

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?

fluttercid avatar Jul 31 '20 14:07 fluttercid

@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

SebastienBtr avatar Aug 01 '20 00:08 SebastienBtr

@fluttercid or @mateus96mt can you provide a project repository to reproduce the issue?

SebastienBtr avatar Aug 01 '20 00:08 SebastienBtr

@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 avatar Aug 02 '20 21:08 sijangurung

@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.

SebastienBtr avatar Aug 08 '20 18:08 SebastienBtr