MarcelGarus / flutter_cached

🧾 Flutter widget allowing easy cache-based data display in a ListView featuring pull-to-refresh and error banners.
BSD 3-Clause "New" or "Revised" License
17 stars 2 forks source link

Custom Pull-to-refresh #6

Open Nico04 opened 4 years ago

Nico04 commented 4 years ago

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.

MarcelGarus commented 4 years ago

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.

Nico04 commented 4 years ago

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 ?

MarcelGarus commented 4 years ago

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?

Nico04 commented 4 years ago

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