Gwt VerticalPanel Cell Height - gwt

I have a horizontalpanel with 3 verticalpanels inside.
In the verticalpanels there are custom widgets
I need all verticalpanels has the same height (even if they have different number of widgets inside) and a button in the empty space.
So, I put all panels height = 100% and the buttons height = 100%.
The problem is that the verticalpanel cells height are bigger than my widgets, so it left a space between all verticalpanels widgets.
Here is an example
How can I adjust the verticalpanels cells height to my widgets height. My widgets are not images like in the example, so i can't know the widgets height.
I have a lot of time in this problem, anyidea will help
Thx!!!!

Haven't tried it, but this should work or at least give you something to start:
VerticalPanel.setCellHeight(yourWidget, Integer.toString(yourWidget.getElement().getOffsetHeight())+"px");
What it does:
setCellHeight() sets the height of the cell the widget is in you pass to the function.
The second parameter in the function is the height of that cell. This gets a little tricky because you don't know the height.
With the getElement() you get the Element of that widget in the DOM of the browser, on that element you can call getOffsetHeight().
getOffsetHeight() returns an integer so you need to cast it into a String and concatenate "px" to it so the browser knows it's pixel and not em or something like that.

Related

In Flutter, what is the difference between Padding and the SizedBox widget?

Since both are used to add spacing to our screen how do we decide when to use either of them .
SizedBox creates space between widget to widget only just height and width.
Padding is how much an element is away from itself — how much distance an element wants to keep with the elements inside it. They create distance top, bottom, left, and right.
Please checout my answer from here

How can I create an infinte grid in flutter?

I want to create a grid with large number of cells. On screen not all cells should be shown, but only some cells at the center of the screen.
Just like the app Desmos.
It should be possible to scroll from any direction in the app.
// THE PROBLEM IS WITH THE NEXT LINE , AS I DON'T THINK I CAN USE double.infinity.toInt() FOR INFINITE //NUMBER OF CELLS. AND EVEN IF IT WORKS HOW CAN I SET THE NUMBER OF CELLS IN A VERTICAL COLUMN TO //INFINITE OR ANY LARGE NUMBER.
GridView.count(crossAxisCount: double.infinity.toInt()),
.....
//Here is the code that will define the 4 Coordinates for each cell.
),
GridView.count creates a scrollable, 2D array of widgets with a fixed number of tiles in the cross axis.
What you need to use is some other GridView constructor like GridView.builder.
https://api.flutter.dev/flutter/widgets/GridView/GridView.builder.html
Creates a scrollable, 2D array of widgets that are created on demand.
This constructor is appropriate for grid views with a large (or
infinite) number of children because the builder is called only for
those children that are actually visible.

Setting row to minimum child height flutter

I'm trying to produce a widget like this below to be contained inside of a listview. I have managed an effect like this rather simply based on the example given on the flutter website for YouTube. However, the part I'm struggling with is that I would like the image to resize vertically depending on how large the text is.
Currently this is created with a row. If possible I'd like to set the row height somehow but only dependent on the height of the text. As some elements will have more text and some will have less I would like to have the image fill the vertical space so the height is the same as the text height.
I basically want this - https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.4
but where the image height on the left matches the text height on the right
Thanks in advance!

Listview with column and 2 buttons - set width to the largest one?

I have a ListView with a Column, and inside that Column 2 buttons.
The ListView is stretched to the entire page (it contains more elements)
I want all the buttons inside the Column to stretch to the button with the largest width.
I found a solution on usnig InstrictWidth, but when used inside a Listview I'm getting the error
LayoutBuilder does not support returning intrinsic dimensions.
How can I still achieve what I'm looking for?
Wrap each button with an Expanded widget and then wrap each one of these Expanded widgets with a Row widget

CellList: How to set row height dynamically?

I have a CellList which will have fix number cells in one page, i would like the cells extend to fill the whole CellList.
Suppose the CellList height is 100px, the cell number is 10, then one cell/row will be 10px, if the CellList height is 500px, each cell/row's height will be 50px.
The problem is, how to control the row height after table rendered, i tried to addLoadingStateChangeHandler on cell list and when onLoad i use GQuery to resize the cell height, but seems no effect.
Yes i can get each row's height beforehand, but how to apply to the CellList's CSS?
Any ideas on this?
Problem solved, when creating a new cell, specify its height(because we know the height beforehand), when resizing the CellList, just redraw it by specifying a new height.