Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapsing Toolbar #7

Closed
taliptako opened this issue Jan 3, 2019 · 3 comments
Closed

Collapsing Toolbar #7

taliptako opened this issue Jan 3, 2019 · 3 comments

Comments

@taliptako
Copy link

Hello,
Thank you I really like this package. I tried adding TabBar to your Sliver example https://github.com/xuelongqy/flutter_easyrefresh/blob/master/example/lib/page/sliver_page.dart
but when its collapse TabBar also collapsing how can i use this package with SliverAppBar and TabBar both for this i need to use NestedScrollView but i dont know if this package works well with it ?

@xuelongqy
Copy link
Owner

NestedScrollView is not currently supported, but you can use CustomScrollView. Because the NestedScrollView is also internally implemented using CustomScrollView, the same effect can be achieved.

// This is the implementation of NestedScrollView
List<Widget> _buildSlivers(BuildContext context, ScrollController innerController, bool bodyIsScrolled) {
	final List<Widget> slivers = <Widget>[];
	slivers.addAll(headerSliverBuilder(context, bodyIsScrolled));
	slivers.add(SliverFillRemaining(
	  child: PrimaryScrollController(
		controller: innerController,
		child: body,
	  ),
	));
	return slivers;
}
...
_NestedScrollViewCustomScrollView(
	scrollDirection: widget.scrollDirection,
	reverse: widget.reverse,
	physics: widget.physics != null
		? widget.physics.applyTo(const ClampingScrollPhysics())
		: const ClampingScrollPhysics(),
	controller: _coordinator._outerController,
	slivers: widget._buildSlivers(
	  context,
	  _coordinator._innerController,
	  _lastHasScrolledBody,
	),
	handle: _absorberHandle,
);
...
class _NestedScrollViewCustomScrollView extends CustomScrollView
...

NestedScrollView just converts all Widgets into slivers of CustomScrollView

@taliptako
Copy link
Author

Okay thanks

@xuelongqy
Copy link
Owner

1.2.4 has been able to support NestedScrollView, you can refer to the example NestedScrollViewPage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants