Flutter expand/collapse container without overflow error - flutter

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.

Related

How to create a Fixed Scrollable portion in CusotmScrollView in 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!

Make scroll responsive to size of column in flutter

I have a screen with a column in flutter which is basically a form. At first i had trouble with the fact that the pop-up keyboard reduced the visible space and thus had an overflow. Fixed that adding the SingleChildScrollView and setting a container as a parent with an specific height (based on devicequery size).
Unfortunately, when I test the rotated screen, i get the same problem. Is there a way to set the height of the container which controls the SingleChildScrollView so that it adjusts to the total size occupied by the column widgets?
Please add Listview instead of Colum Widget.
in your scaffold
set resizeToAvoidBottomInset to false or add it
resizeToAvoidBottomInset:false

How to let resize and also give margin for whole screen in Flutter?

I want to give a margin around the whole screen in Flutter. So I put my content inside a Column and put the Column inside a Container. So I gave a padding to the whole screen. But when a TextField is selected and the keyboard appears the bottom overflow. I can't give resizeToAvoidBottomPadding: false, because then the keyboard covers the TextField.
I can't use SingleChildScrollView or a ListView because then the placing of the children won't keep space between.
It seems the only option is to remove the Container and set a padding to each child of the Column.
Is there a better option for this ?

create expand collapse image when scroll listview

example
I want to create some applications with widget ListView. When you scrolling up, image at first index will be expanded, and if you scroll again, next image will be expanded again, and if you scrolling down, image will be collapsed again.
Is it possible to create this with flutter?

How to position widgets inside column in flutter?

I have two widgets to be placed inside column. The first widget is a TabbarView widget, whose content could be long. The second widget is a TabBar. I want the tabbar to stay always at the bottom of the column and allot the remaining space to TabbarView widget.
Suggest a solution other than using Flex.
This is a quick work around, you can try wrapping your TabbarView in a container and giving it a height using Mediaquery.of(context).size.height * .94
then for the remaining space add your TabBar