I have multi-line text inside an Expanded. But instead of showing ellipsis (as specified), it clips the text at the bottom.
This is because it only truncates after the specified maxLines. But depending on my device size the amount of lines that fit in the available space will vary. I need the text to be as long as possible before it truncates.
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: SizedBox(
width: 100,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: Text(
'This is some really long multiline text This is some really long multiline text This is some really long multiline text.',
overflow: TextOverflow.ellipsis,
maxLines: 20,
),
),
],
),
),
),
);
}
}