I have a container that has a width of 300 which shows the name widget on it. The name widget must truncate the names longer than 300 width. It shows three dots that indicate it truncates the text, but only shows the first 4 letters of the name, I want to show the name as far as possible up to 300 pixels. How to do that.
The widget that calls the name widget
Row(children: [
Container(
width: cardWidth,
child: Padding(
padding: EdgeInsets.only(top: 22),
child: Align(
alignment: Alignment.center,
child: Container(
width: 300,
child: FittedBox(
fit: BoxFit.contain,
child: SizedBox(
width: cardWidth,
child:
NameWidget()),
),
),
),
),
),
The name Widget
Stack(
alignment: Alignment.center,
children: <Widget>[
Container(
child: Row(
children: [
Flexible(
child: new Container(
width: 250,
padding: new EdgeInsets.only(right: 13.0),
child: new Text(
'Text largeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeEEE',
overflow: TextOverflow.ellipsis,
style: new TextStyle(
fontSize: 25.0,
fontFamily: 'Roboto',
color: new Color(0xFF212121),
fontWeight: FontWeight.bold,
),
),
),
),
Icon(Icons.home)
],
Output shown (see, there's more space to show more letters of the name)
