dash_chat icon indicating copy to clipboard operation
dash_chat copied to clipboard

Date separator is wrong on inverted list

Open edukun opened this issue 4 years ago • 5 comments

Describe the bug When inverted: true, date separator doesn't work as expected.

To Reproduce

  • Add 2 messages, dates 2nd of August and 5th of August, current user
  • Add one message, date 7th of August, other user

Expected behavior Three different date separators, only found 2 and with wrong date

Screenshots First screenshot, inverted: true, where the problem occurs. inverted_true

Second screenshot, inverted: false, all ok. inverted_false

  • OS: Mac
  • Device: Samsung Galaxy S9
  • Flutter Version: Flutter (Channel dev, 1.21.0-1.0.pre, on Mac OS X 10.15.5)
  • Dart Version: 2.9.0
  • Dash Chat Version: 1.1.14

edukun avatar Aug 07 '20 08:08 edukun

Changing the date of most recent message to two weeks ago, the problem shows too

inverted_true_2

edukun avatar Aug 07 '20 09:08 edukun

@SebastienBtr any comments on this bug?

edukun avatar Aug 18 '20 10:08 edukun

it seems to appear only for the first message, I didn't have time to check the code so I don't know exactly why it happens. I'll check that when I have more time. There is multiple issues with the date separator apparently, I'd honestly suggest to maybe not use it and wait for the v2. Anyway your issue is maybe quick to fix so I'll keep you updated.

SebastienBtr avatar Aug 18 '20 10:08 SebastienBtr

Ok, thanks!

El 18 ago 2020, a las 12:17, SebastienBtr [email protected] escribió:

it seems to appear only for the first message, I didn't have time to check the code so I don't know exactly why it happens. I'll check that when I have more time. There is multiple issues with the date separator apparently, I'd honestly suggest to maybe not use it and wait for the v2. Anyway your issue is maybe quick to fix so I'll keep you updated.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fayeed/dash_chat/issues/124#issuecomment-675393063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMALDHRASM5WF4OK3EU7ATSBJIKNANCNFSM4PXNKCFQ.

edukun avatar Aug 18 '20 10:08 edukun

You can also use a sorting function based on date to fix it, with something like this:

messages.sort((messageA, messageB) => messageB.createdAt.compareTo(messageA.createdAt));

DarkPhanuel avatar Aug 24 '23 13:08 DarkPhanuel