Get the line height of a RenderObject of a RichText in Flutter? - flutter

I'd like to get the actual line height of a RichText.
This can easily be achieved if there is only one line of text, as the size of the RichText's RenderObject will be the text's too.
But if it is multi-line, this of course doesn't work anymore.

Related

how display material ui helper Text in one line

I want to show helperText of matrial ui text field just in one line, my text field width is lower than helperText width and it goes to next line
does this problem have a solution ?

Widget that takes up a fixed maximum of space, but shrinks to make room for other widgets inside Row

My Flutter UI has a Row widget with and arbitrary number Widgets in it. I would like to move all of those widgets over to the right by a fixed amount. But the caveat is, if the other widgets grow in width such that the available horizontal space is consumed, the spacing widget will relinquish its space.
The Spacer widget does not work for me, as it does not allow you to specify a fix maximum. It only allows a flex value, which is a function of the width of the other content in the row. I want this spacer to take up a fixed amount of space regardless of the width of the other content of the row (unless all the room is used up).
Try using sizedBox or FractionallySizedBox as explained in this answer
https://stackoverflow.com/a/63430801/8213343

Flutter Calculate Height of RichText Widget

I have a Column that holds an array of Container Widgets. The Height of one of these Container Widgets is dependent on the Heigth of the Rich Text Widget it holds, for better understanding here is a screenshot:
I want the History Container to be the same height as all the other ones, is there an elegant solution to do this?
You can give a fixed height to a container ! and set text to fit in one line Text('Name',maxLines: 1,), so it will take same height in all row.
or
Alternatively you can add a empty Text widget as subtitle(grey one) in History row.
like -> Text(" ", style:TextStyle()) Give it same style as other subtitle. as result Text widget will take it space like other but wont be visible to UI.
By wrapping every widget on your Column with an Expanded widget, they will all share the same height.

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!

How can I get a text width?

I want to modify a Gtk.Entry to fit its text width, how can I get the text width?. I've tried setting an average width for each character, but It don't work properly
GTK+ widgets have their rendering layout done by Pango, so first, create a Pango Layout for your widget by calling create_pango_layout with the text you want on your Gtk.Entry and then use get_size to get the dimensions.