flutter_animate icon indicating copy to clipboard operation
flutter_animate copied to clipboard

support slivers

Open RobertHeim opened this issue 2 years ago • 9 comments

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),
)

RobertHeim avatar Oct 16 '22 20:10 RobertHeim

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

esDotDev avatar Oct 18 '22 18:10 esDotDev

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

fredgrott avatar Jan 17 '23 18:01 fredgrott

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.

gskinner avatar Jan 18 '23 17:01 gskinner

Please add support to SliverList

wesleytoshio avatar Apr 17 '23 11:04 wesleytoshio

+++

glin94 avatar Apr 30 '23 21:04 glin94

Looking forward to this

sagar-tide avatar Oct 26 '23 06:10 sagar-tide

Any progress on this?

hmirza1 avatar Mar 16 '24 03:03 hmirza1

Still looking for any update on this support for slivers

btrincao-i9 avatar May 14 '24 14:05 btrincao-i9

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.

fredgrott avatar Jul 10 '24 16:07 fredgrott