简体   繁体   中英

Flutter use RefreshIndicator in CustomScrollView

I'm working with Flutter v0.5.1

I want to build a app with SliverAppBar to auto hide when scroll up and float when scroll down. I use CustomScrollView with sliverList are SliverAppBar and MyWidget1, which is a FutureBuilder to show CircularProgressIndicator when loading data and MyWidget2 when successfully loaded data. MyWidget2 is a RefreshIndicator to user can pull to refresh data. The layout I expect is CustomScrollView -> (SliverAppBar and FutureBuilder -> RefreshIndicator)

And the problem is that I can't use RefreshIndicator in CustomScrollView because CustomScrollView need a SliverList with RenderSliver and RefreshIndicator is not.

After trying more times I find out RefreshIndicator must be inside FutureBuilder because if reverse the order RefreshIndicator would rebuild FutureBuilder and show CircularProgressIndicator when it refresh. I expect to show only RefreshIndicator. And I want to use FutureBuilder inside CustomScrollView to show SliverAppBar when FutureBuilder show CircularProgressIndicator

Any idea for me

Thank all,


p/s: sr for my English

Just make sure, did you try like this? RefreshIndicator -> CustomScrollView -> other silvers. It works, but you don't want to do like this, right?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM