samderlust / calendar_day_view

MIT License
6 stars 11 forks source link

Any plans for a Sliver variant #4

Closed Paul-Todd closed 1 year ago

Paul-Todd commented 1 year ago

Hi,

I know we can wrap this into a SliverToBoxAdaper

return CustomScrollView(

      slivers: [
         SliverAppBar.medium(
          .....
           floating: true,
           pinned: true,
        ),
        SliverToBoxAdapter(
          child: OverFlowCalendarDayView(...),
        ),
      ],
    );

but it does not play nicely with other slivers and you really need a SliverListl

samderlust commented 1 year ago

Hi @Paul-Todd , Thanks for your feedback but could you please elaborate on the issue?

Paul-Todd commented 1 year ago

Hi, I have built a POC here that shows the issue.

Whilst we can wrap the OverFlowCalendarDayView in a SliverToBoxAdapter the behaviour is not synchronized with the header and so we see that you manuallly have to shrink the header to get the list to function

The proposed patch adds a primary property to the OverFlowCalendarDayView control which allows the control to then have its scroll behaviour controlled by the parent.

Toggle the switch on the app bar to see the difference in behavious. With the switch off the header shrink is manual and with it on the header shrink is automatic

I can do a PR with my proposed change if that makes sense. I have added a non breaking change to the OverFlowCalendarDayView that delegates the controller to the calling scoller (Sliver). This property is optional and defaults to false which is the previous behavior.

samderlust commented 1 year ago

@Paul-Todd Thank you for the POC. I tested with Sliver before but only on web base and surprisingly it seems to work fine. But I just run on mobile now and I see the issue you're mentioning. I'm looking more into this issue and see what I can come up with. I also looked into your folk as well. but want to see if there is more I can do

samderlust commented 1 year ago

@Paul-Todd I can see that the issue can be fixed easily by deleting physics: const AlwaysScrollableScrollPhysics() and letting the app imply the physic. However, I would like to allow the user to add ScrollController, physic, and primary

samderlust commented 1 year ago

@Paul-Todd v1.5 is released https://pub.dev/packages/calendar_day_view

Paul-Todd commented 1 year ago

I will try it