gskinner / flutter_animate

Add beautiful animated effects & builders in Flutter, via an easy, highly customizable unified API.
BSD 3-Clause "New" or "Revised" License
951 stars 80 forks source link

support slivers #30

Open RobertHeim opened 2 years ago

RobertHeim commented 2 years ago

Would be grate if we could do this:

CustomScrollView(
  slivers: [
     ...
  ].animate(interval: 100.ms)
    .move(
      curve: Curves.easeOut,
      duration: 300.ms,
      begin: const Offset(100, 0))
    .fade(duration: 100.ms),
)
esDotDev commented 2 years ago

@gskinner I think the issue here is that slivers must be a list of RenderSliver children. The compiler misses it, because it accepts List<Widget> but at some pt a runtime check is performed and it must be List<RenderSliver>

So code like:

CustomScrollView(
  slivers: [
     SomeSliver();
  ].animate(interval: 100.ms)

Needs to produce something like:

CustomScrollView(
  slivers: [
     SliverToBoxAdapter( // This is a `RenderSliver`, so no error will be triggered
       child: Animate(
          ...
          child: SomeSliver(),
       )
     )
  ]

But I'm not sure that would work properly: would it break the normal behavior of SomeSliver to have it be nested like that?

fredgrott commented 1 year ago

Note, the workaround right now is to use the auto_animated package for slivers.

gskinner commented 1 year ago

This is a tricky one. I'll try to set up a test file some time soon and play around, but I don't have any specific ideas on how to solve it yet.

Thoughts / ideas / code sketches are welcome.

wesleytoshio commented 1 year ago

Please add support to SliverList

glin94 commented 1 year ago

+++

sagar-tide commented 1 year ago

Looking forward to this

hmirza1 commented 7 months ago

Any progress on this?

btrincao-i9 commented 5 months ago

Still looking for any update on this support for slivers

fredgrott commented 4 months ago

The work around obviously is have your target slivers use a builder delegate...if you look in the MD3 demo app it uses builder delegates for the component screen of slivers. Because it does that I can apply animate and effects to the list of widgets despite it finally rendering to slivers.