I having hard to understand the difference between NestedScrollView and CustomScrollView?
NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.
A CustomScrollView lets you supply slivers directly to create various scrolling effects, such as lists, grids, and expanding headers. For example, to create a scroll view that contains an expanding app bar followed by a list and a grid, use a list of three slivers: SliverAppBar, SliverList, and SliverGrid.
A scrolling view inside of which can be nested other scrolling views, with their scroll positions being intrinsically linked.
Now lets start implementation of CustomScrollView in Flutter First of all, create a basic project and return a Custom Scroll View widget. Then, add a silver app bar and then add a silver grid. Here we only used two child widgets in the custom scroll view. The Entry point of code.
CustomScrollView
- is the most customizable way to build any "scroll" based layouts using Sliver
objects. SingleChildScrollView
and NestedScrollView
are both build on top of it.
NestedScrollView
- is a Wiget provided for a very particular use-case - to put One Scrollable object inside another (in most case - where the directions are not same).
This is what is mentioned in the doc for NestedScrollView
A scrolling view inside of which can be nested other scrolling views, with their scroll positions being intrinsically linked.
The beauty of flutter is that it is open source, you can check the source code to know what is going on under the hood.
Souce Code:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With