NestedScrollView: extended nested scroll view to fix following issues.
2.inner scrollables in tabview sync issue
3.pull to refresh is not work.
4.do without ScrollController in NestedScrollView's body
Web demo for ExtendedNestedScrollView
Do without ScrollController in NestedScrollView's body
give total height of pinned sliver headers in pinnedHeaderSliverHeightBuilder callback
var tabBarHeight = primaryTabBar.preferredSize.height;
var pinnedHeaderHeight =
//statusBar height
statusBarHeight +
//pinned SliverAppBar height in header
kToolbarHeight;
return NestedScrollView(
pinnedHeaderSliverHeightBuilder: () {
return pinnedHeaderHeight;
},
Put your list which in tabview into NestedScrollViewInnerScrollPositionKeyWidget,and get unique a key
return extended.NestedScrollViewInnerScrollPositionKeyWidget(
widget.tabKey,
ListView.builder(
itemBuilder: (c, i) {
return Container(
alignment: Alignment.center,
height: 60.0,
child: Text(widget.tabKey.toString() + ": List$i"),
);
},
itemCount: 100)
);
get current tab key in innerScrollPositionKeyBuilder callback. this key should as same as in step 1 given.
extended.NestedScrollView(
innerScrollPositionKeyBuilder: () {
var index = "Tab";
if (primaryTC.index == 0) {
index +=
(primaryTC.index.toString() + secondaryTC.index.toString());
} else {
index += primaryTC.index.toString();
}
return Key(index);
},
NestedScrollViewRefreshIndicator is as the same as Flutter RefreshIndicator.
NestedScrollViewRefreshIndicator(
onRefresh: onRefresh,
child: extended.NestedScrollView(
headerSliverBuilder: (c, f) {
return _buildSliverHeader(primaryTabBar);
},
Please see the example app of this for a full example.
due to we can't set ScrollController for list in NestedScrollView's body(it will breaking behaviours of InnerScrollController in NestedScrollView),provide Demos
to show how to do it without ScrollController
to show how to change pinned header height dynamically.