Container(
height: 100,
color: Colors.black,
child: const Text(
'height, width vs varsa önce bunlar kendisini ön plana çıkartır. ardından expanded olanlar geri kalan kısımları bölüşür',
style: TextStyle(color: Colors.white),
),
),
I want to see my full text both horizontally and vertically. my text is clipped and I can't see parts of my text. cropped text(idont want this).There is no problem in the horizontal, but some of the texts are lost due to lack of space when turning vertically. I don't want it to be a single line. my text should take shape automatically with the most suitable size in the whole container
I tried widgets such as FittedBox, FractionallySizedBox, LayoutBuilder, but without success.I don't want to use 'AutoSizeText'. because I don't want to specify values such as how many rows it will occupy, its minimum and maximum size. all features such as sizing, line decrease/increase should be automatic
The way that layout works in Flutter is: "Constraints go down, sizes go up."
Source: https://docs.flutter.dev/ui/layout/constraints
What does it mean?
Textwidget is aContainerand its setting its maximum height to 100.0.Textwidget is receiving a constraint where its maximum height is 100.0.How can I solve it?
The
Textwidget will now take up as much height as it needs. However, you need to keep in mind other constraints imposed higher up in the widget tree.For example, if the
Textis inside aContainer, but theContaineris inside aRow, it will have an unbounded width. For your specific case, you will like want to specify a maximum width, and let theTextwidget take up as much height as it needs.BONUS: An utility function that allows you to determine String size:
Usage: