flutter_cached icon indicating copy to clipboard operation
flutter_cached copied to clipboard

Custom Pull-to-refresh

Open Nico04 opened this issue 5 years ago • 4 comments
trafficstars

With your current implementation, it seems that if I have a ListView inside a Column for instance (with a footer), the pull-to-refresh doesn't work.

             Column(
                children: <Widget>[
                  Expanded(
                    child: ListView(
                      children: List.generate(20, (index) => Text('$index')),
                      itemExtent: 100,
                    ),
                  ),
                  Text('Footer'),
                ],
              );

And if I set hasScrollBody: false, it throws.

I guess I would have to use the PullToRefersh directly above the ListView, inside the Expanded. Maybe the pull-to-refresh should be optionnal or external, so we can use our custom behaviour ? For instance I could want to implement a custom PullToRefresh component like this.

Thanks.

Nico04 avatar Mar 12 '20 14:03 Nico04

Having multiple nested scrolling views is kind of hard to do currently. It is easily possible though by going one abstraction layer deeper – that is, using Slivers. Currently, you'd have to instantiate a Sliver inside a CachedRawBuilder. I'm looking forward though to release a CachedRawSliverBuilder of some sort that can directly be used inside other slivers.

MarcelGarus avatar Mar 12 '20 14:03 MarcelGarus

I've tried a lot of combinaison of sliver inside a CustomScrollView, but I didn't succeed to enable your PullToRefresh with a footer. You have a lead to do that ?

Nico04 avatar Mar 12 '20 14:03 Nico04

Not really… The package uses the PullToRefresh widget from the pull_to_refresh package and I'm not an expert in how exactly it works… Maybe you could do some further research in that direction or open a support issue over there?

MarcelGarus avatar Mar 12 '20 15:03 MarcelGarus

As I needed to change the pull-to-refresh component, I had to remove your package, so I'll will not investigate more, sorry. Your package has a lot of potential ;)

Nico04 avatar Apr 09 '20 07:04 Nico04