Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow floating dateDivider to be above the messages #842

Closed
1 task done
duzenko opened this issue Dec 28, 2021 · 23 comments · Fixed by #1090
Closed
1 task done

Allow floating dateDivider to be above the messages #842

duzenko opened this issue Dec 28, 2021 · 23 comments · Fixed by #1090
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@duzenko
Copy link

duzenko commented Dec 28, 2021

Which packages are you using?

stream_chat_flutter

On what platforms did you experience the issue?

Android

What version are you using?

latest

What happened?

the custom floating date overlaps and blends with the messages

Steps to reproduce

Use custom divider text

Supporting info to reproduce

image

Relevant log output

No response

Flutter analyze output

No response

Flutter doctor output

No response

Code of Conduct

@duzenko duzenko added the bug Something isn't working label Dec 28, 2021
@deven98
Copy link
Contributor

deven98 commented Dec 29, 2021

Hi @duzenko,

Assuming I have understood your bug correctly, here is some more information about date dividers:

The MessageListView keeps two types of date dividers - ones that are embedded in the listview and the second is a floating date divider which changes once it passes an embedded date divider beneath it. The one which you have mentioned that overlaps with the messages is the floating date divider.

You can either choose to turn off the floating date dividers like this:

    MessageListView(
        showFloatingDateDivider: false,    
    ),

OR you can add some kind of background to the date dividers like this to not make it look overlapping with the messages:

    MessageListView(
        dateDividerBuilder: (dt) {
            return Center(
                child: Container(
                    padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1),
                    decoration: BoxDecoration(
                        color: Colors.white.withOpacity(0.7),
                        borderRadius: BorderRadius.circular(8),
                    ),
                    child: Text(
                        'Your text here',
                    ),
                ),
            );
        },
    ),

Let me know if this makes sense or if you think I may have misunderstood the issue at hand.

@duzenko
Copy link
Author

duzenko commented Dec 29, 2021

Thanks, the two workarounds are kinda obvious
I was wondering if you can make the floating date to show above the messages, not on top of them

@imtoori
Copy link
Contributor

imtoori commented Dec 29, 2021

Hi @duzenko
can you elaborate more on this? I'm not getting it, thanks

@duzenko
Copy link
Author

duzenko commented Dec 29, 2021

Hi @duzenko can you elaborate more on this? I'm not getting it, thanks

Use a Column instead of Stack

@imtoori
Copy link
Contributor

imtoori commented Dec 29, 2021

we have a date divider in a column. In your screenshot December 28 is not in a Stack, and it's above the message, isn't it?

@duzenko
Copy link
Author

duzenko commented Dec 29, 2021

"August 3" on top is in a stack

@imtoori
Copy link
Contributor

imtoori commented Dec 29, 2021

yes, that's the floating date divider that shows you the current timestamp you're on.
You can remove that as @deven98 mentioned here

Am I missing something?

@deven98
Copy link
Contributor

deven98 commented Dec 29, 2021

Just for some clarification: Both date dividers exist at the same time by default - as shown in your screenshot. If you don't allow the floating date divider, it will still show as column instead of a stack. If this is still confusing, you can send us a basic wireframe for us to understand better.

@duzenko
Copy link
Author

duzenko commented Dec 29, 2021

If the floating date is disabled then the first messages show up without date at all

@deven98
Copy link
Contributor

deven98 commented Dec 30, 2021

Hi @duzenko,

Would having the first messages with the date solve your issue?

@duzenko
Copy link
Author

duzenko commented Dec 30, 2021

Hi @duzenko,

Would having the first messages with the date solve your issue?

I think so, however it's not very clear what you mean

@imtoori
Copy link
Contributor

imtoori commented Jan 3, 2022

hey @duzenko
you could use the MessageListView.headerBuilder parameter like this

                  showFloatingDateDivider: false,                  
                  headerBuilder: (context) {
                    final date = StreamChannel.of(context)
                        .channel
                        .state
                        ?.messages
                        .first
                        .createdAt;
                    if (date == null) {
                      return const Offstage();
                    }
                    return DateDivider(
                      dateTime: date,
                    );
                  },

Let me know if that works for you

@duzenko
Copy link
Author

duzenko commented Jan 4, 2022

I think that's an okayish workaround
Ideally I would like an option for the floating date to not overlap with the messages

@imtoori
Copy link
Contributor

imtoori commented Jan 7, 2022

I don't think this makes a lot of sense, but I think I know how to help you with this
For now please use our workaround, I'll find a way of adding the date divider to the top when you disable the floating one

@rohan20
Copy link

rohan20 commented Feb 8, 2022

@imtoori Would it be possible to provide showFloatingDateDivider on top of stream_chat_flutter: ^2.0.0-nullsafety.2?

stream_chat_flutter: ^2.0.0-nullsafety.2 is the only version we are compatible with. We just upgraded from stream_chat_flutter: ^1.5.6 but it seems that this flag was only made available on stream_chat-v2.0.1. This is a critical issue for us and earlier you helped us get this flag as a hotfix on ^1.5.6. Would be immensely helpful if you could do something similar on top of stream_chat_flutter: ^2.0.0-nullsafety.2.

Happy to open a PR if you like:

if (widget.showScrollToBottom) _buildScrollToBottom(),
if (widget.showFloatingDateDivider) ...{
  Positioned(
     ...
   );
},

@imtoori
Copy link
Contributor

imtoori commented Feb 9, 2022

@rohan20 do you want to hide the date divider? that's why you need it, right?

@rohan20
Copy link

rohan20 commented Feb 9, 2022

@imtoori Yes. We want to set showFloatingDateDivider to false.

@rohan20
Copy link

rohan20 commented Feb 10, 2022

@imtoori Just checking if you have a decision on this? :)

@xsahil03x
Copy link
Member

Hey @rohan20, we are happy to receive a PR for this.
Can you make one and assign me as a reviewer?

Thanks,
Sahil

@rohan20
Copy link

rohan20 commented Feb 10, 2022

Thanks @xsahil03x. I can do that. Can you please create a branch from the 2.0.0-nullsafety.2 git tag that I can base my PR on?

@xsahil03x
Copy link
Member

@rohan20 sure, here you go https://github.com/GetStream/stream-chat-flutter/tree/release/2.0.0-nullsafety.2

@rohan20
Copy link

rohan20 commented Feb 10, 2022

@xsahil03x I couldn't assign you as a reviewer (no rights I suppose), but here's the PR. Thanks!

@xsahil03x
Copy link
Member

@imtoori imtoori moved this from Backlog to Current Sprint Goals in Stream Chat Flutter Team Planning Mar 10, 2022
@imtoori imtoori modified the milestone: Sprint 1 Mar 10, 2022
@imtoori imtoori added the enhancement New feature or request label Mar 16, 2022
@imtoori imtoori self-assigned this Apr 14, 2022
@imtoori imtoori moved this from Current Sprint Goals to In Progress in Stream Chat Flutter Team Planning Apr 15, 2022
@imtoori imtoori moved this from In Progress to Reviewing in Stream Chat Flutter Team Planning Apr 19, 2022
@imtoori imtoori moved this from Reviewing to Done in Stream Chat Flutter Team Planning Apr 19, 2022
@imtoori imtoori moved this from Done to Reviewing in Stream Chat Flutter Team Planning Apr 19, 2022
@imtoori imtoori moved this from Reviewing to Done in Stream Chat Flutter Team Planning Apr 19, 2022
@imtoori imtoori moved this from Done to Reviewing in Stream Chat Flutter Team Planning Apr 19, 2022
Repository owner moved this from Reviewing to Done in Stream Chat Flutter Team Planning Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants