Reputation: 451
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
Upvotes: 2
Views: 4608
Reputation: 389
If you want to show refresh indicator below the sliverAppbar you specify edgeOffset parametr in your refresh indicator and it will look like your refresh indicator inside custome scroll view. For example:
RefreshIndicator(
edgeOffset: yourAppBarHeight,
onRefresh: () {
//something
}
child: CustomScrollView(
slivers: [
SliverAppBar(),
SliverList(),
]
)
)
Upvotes: 1
Reputation: 11
Just make sure, did you try like this? RefreshIndicator -> CustomScrollView -> other silvers. It works, but you don't want to do like this, right?
Upvotes: 1