The fixed height container wraps a text, the text text will be very long, but it will appear in the four line of the figure with a crop, what I want is if it is not fully displayed, it will not be displayed. How to fix it? The height of the container must be fixed.
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
context,
title: "Input list",
),
body: Container(
child: Text(
"The fixed height container wraps a text, the text text will be very long, but it will appear in the four line of the figure with a crop, what I want is if it is not fully displayed, it will not be displayed. How to fix it? The height of the container must be fixed",
style: TextStyle(fontSize: 14, color: Colors.black),
),
width: double.maxFinite,
color: Colors.greenAccent,
height: 58,
),
);
}
The height of the container will be adaptive according to other widgets. Then I want to display more text without cropping the last line.
2
Answers
Give your
Text
anoverflow
value, for exampleIf you want the overflowed text not to display, you can use
overflow: TextOverflow.clip
Example:
Try this code in dartpad
The
TextOverflow.clip
removes all the oveflowed textMY LONG TEXT
becomes `MY LONG T’Output: