what is the equivalent to Filexible in slivers flutter? - flutter

SliverFillRemaining is the same as Expanded render box.. i need an equivalent to Flexible inside Slivers.
How Could I do so, so that i can make the widget fit it's content but could have infinity height inside a column?

Related

Is there a way to dynamically size a widget according to whatever the size is left on the screen in Flutter?

Lets just say I have 2 widgets on the screen, one a dynamic container that the size depends on the things that are inside that container, and the second widget would be a scrollable ListView. Ideally, I am trying to have both widget on a non scrollable screen, only having the list view to be scrollable. I have tried using a GlobalKey attached to the dynamic container, and then defining the size of the container that's holding the ListView widget with that, but it did not work. This is done on Flutter Mobile development
There are multiple ways to do this. Here is how I would do it-
To limit the height of ListView, wrap the ListView with a Container widget and set the height of the Container to the required height. To make the container cover entire space, wrap with in an Expanded widget. So this is how your widget tree would look like-
//Expanded { //Container { //ListView }}

which class or widget to use a better responsive layout in the flutter?

This class or widget is useful to create a responsive layout.
AspectRatio
CustomSingleChildLayout,
CustomMultiChildLayout,
FittedBox,
FractionallySizedBox,
LayoutBuilder,
MediaQuery,
MediaQueryData,
OrientationBuilder.
Which is to use the better responsive layout.
iDecode already told you that it all depends on what you need. here take a look at official documentation, https://flutter.dev/docs/development/ui/layout.
And here is my advice
Use row when you need Horizontal layout
Use column when you need Vertical layout
Use singleChildScrollView when you need scrolling layout
Use either GridView or listView when you need repetitive view
Use Expanded, Flexible, Limitedbox, flexiblebox for adjusting the size of the widget
Mine favourite : Rows for Horizontal, Column for vertical, Scrollview for Extra data exist in the page or UI not fitted in the screen, ListView for TableView UI etc
For best fitting layout: IS Expanded, AspectRatio

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

flutter gridView child height is fixed, add other widget cannot show?

here:
below the picture there is an inline text, but it is not visible. Maybe be the picture's height takes up the whole height? Any idea?
You are using GridView.builder. Instead you can use GridView.count.
In GridView.count, there is a parameter childAspectRatio which you can use to increase the height of the grid.

Differences between SliverList vs ListView in Flutter

What are the differences between SliverList and ListView in Flutter?
There's almost no difference.
ListView is a SliverList. Same with GridView, which is a SliverGrid.
They are doing exactly the same thing. The only difference between them is that SliverList is a sliver, not a widget. Which means it's used inside a ScrollView, usually CustomScrollView.
ListView is nothing else but a biding of SliverList to transform it into a Widget to make it usable alongside other widgets such as Row/Container.
Most of the time, use ListView.
But if you want advanced scroll behavior such as appbar animations with scroll ; you'll need to use a CustomScrollView. Which will force you to use SliverList instead of ListView.
According this article,
All of the scrollable views you use, like ListView and GridView,
are actually implemented using Slivers. You can kind of think of
Slivers as a lower-level interface, providing finer-grained control on
implementing scrollable area. Because slivers can lazily build each
item just as it scrolls into view, slivers are particularly useful for
efficiently scrolling through large numbers of children.