How to create a Fixed Scrollable portion in CusotmScrollView in flutter? - flutter

I am using a CustomScrollView and Slivers inside it and redendering the list using SliverChildBuilderDelegate. This works fine, but my requirement is to have a Fixed Container of height = height of screen/2 and inside that I want to render a list and and it can scroll as well, I am using CupertinoSliverNavigationBar [this cannot be replaced]. I am able to draw a Container and inside that I am able to show a list using Listview.builder, but the problem is I am unable to scroll the list, whenever I scroll it, it goes to top again, I want something Like, my CustomScrollView should be kept as it is, just I want to create a Scrollable Container of fixed height and the list inside that should scroll properly and CustomScrollView can also scroll, I have tried many widgets like Wrap, Rows, Columns, SingleChildScrollView, also tried NeverScrollPhysics() Behaviour for CustomScrollView but nothing is working out. Please Help!

Related

Flutter expand/collapse container without overflow error

Does anybody have a clue how to achieve expand/collapse animation for a given Container widget?
I tried to use ExpandablePanel but it is not what I really want, because I want to render a Column within a Container, and if the Container is collapsed I want to show only 150px from it, otherwise it should have the height of the content.
Clicking on the arrow the Container should toggle it's state.
Below are some images which represents the goal:
Collapsed
Expanded
The overflow error is thrown because when the column is collapsed there is no room to contain all the children inside the column.
What do we do when we have a column with children's height larger than the screen height? We use scrolling!
So you can wrap your column with SingleChildScrollView widget to make the column scrollable, so when it collapses it doesn't complain about the children's height, instead, the scrolling functionality handles them because you can scroll in a column even if it has very small width.

Flutter scrollable list inside overlay

My question is similar to this How to make my page scrollable when i show overlay element, that have too many items in flutter? but it has no answers so I'll try to ask as well:
I have an Overlay showing a list of questions using ListView. The list of questions is long and I need to enable scrolling inside the Overlay.
Now it's static and part of it disappears at the bottom of the mobile device.
Why is not just scrollable (since the list inside the Overlay is inside a ListView) and is there a way to make it scrollable?
Thanks in advance for any help!
UPDATE (SOLVED) :
The problem was that the ListView widget is inside a Positioned widget and the top, left, bottom and width values (in my case) need to be set in order for the content to be scrollable.
The problem was that the ListView widget is inside a Positioned widget and the top, left,bottom and width values (in my case) need to be set in order for the content to be scrollable.

Use a ListView.builder and wrap widgets dynamically

I try to solve the following problem: I want to have a dynamically generated set of cards widgets which should be layed out horizontal and wrap the line when the card is getting too big:
I was thinking of a ListView.builder but this can either go horizontal or vertical. More, a gridview seems also not the best option as I have no fixed columns or rows. Is there any way in doing so or exists there maybe a widget I am not aware of currently?

How to keep the scrolling position when adding a new elements in the top using ListView or CustomScrollView in Flutter

Is it possible to add new elements into the top of the ListVeiw or CustomScrollView and keep the scroll position as it's with Flutter
I've tried the following
extentAfter = _scrollController.position.extentAfter;
_scrollController.jumpTo(_scrollController.position.maxScrollExtent - extentAfter);
but this won't work well with SliverAppBar - floating and its actually not optimal solution.
Actually the cleanest way would be to add those items only when user scrolls back to the top of the ListView. You can cache them in memory for the moment user is far enough from the top (in your case) of the list.

Twitching Scrollbar in listview with dynamic height children

Code example: https://gist.github.com/v1z4/4c231063b9e22eac5961fb0c437119fe
I have a list of dynamic elements with different height, and I need to have a scrollbar. I use iOS style widgets, so I have wrapped ListView in CupertinoScrollbar().
I test it in real device attached, because simulator does not have scrollbar.
The list works fine, but scrollbar is twitching, because the height of elements are different.
It works fine when I add fixed height to container in ListView element, but text is being cropped and looks bad. Is there a way to fix twitching?