How to add swiping functionality on ListView? I do not know the exact number of childs to use PageView, moreover I think having just a horizontal swipe on a scrollable widget is what will fit better.
if your want to add swipping functionality in PageView then you can use PageView.builder instead of just PageView.
Related
I want to make it responsive like if I move the slider then correspondent list which is below should be highlighted and should move according to the slider.
I have tried PageView controller to pass in ListView controller but it never worked.
I have an AppBar and other things in my layout. When user scrolls down, I want AppBar(actually, the Toolbar to show based on category).
How to achieve this appbar appear when scrolling the listview ?
Here the example i want to make like this.
Before scrolling
After Scrolling Appbar Appear and fixed at top
Actually, I'm using a Silver AppBar in Flutter and inside it, I'm using a ListView Builder that has its own scroll. So basically there are two scrolls. But when I scroll List View Builder, Silver AppBar doesn't scroll. I want both of them to scroll from anywhere. What do I do?
Use sliver list istead of list view the problem will solve
here is the link of widget : https://api.flutter.dev/flutter/widgets/SliverList-class.html
You can put NeverScrollableScrollPhysics as a scroll physics for ListView.builder, so AppBar will scroll as with the content, maybe this is what you are looking for.
I can add ScrollController to a ListView. I was trying to do the same for SliverList but I realized there is no parameter to add a controller. Is there any other way I can achieve this?
Thank you.
You cannot add it to a SliverList, you can however, add the controller to your parent CustomScrollView. The SliverList comes inside the CustomScrollView and should give you the effect you want.
As you can see in the screenshot, you can add a controller to your CustomScrollView
I have a scrollable widget, say a ListView, which contains some special widget.
How can I prevent the scrollable to scroll when the user tries to scroll by starting to scroll on top of that widget?
In other words, I want that widget to be like a "hole" that prevents the scrollable to sense gestures there.
Wrap the widget with GestureDetector and implement empty gesture functions in it.
GestureDetector(
onVerticalDragUpdate: (_) {},
child: YourWidget
),
The answer is not satisfying because it prevents the child from receiving gestures (at least on native platforms).
Only acceptable solution I found -- in my case with a PageView -- is to disable the scroll gestures when the page with the gesturedetector child displays.
If anyone has a cleaner solution, please let us know.