FlatButton.icon with Overflowing Text in Flutter
Define a maxWidth property like this :
Container( color: Colors.red, constraints: BoxConstraints( maxWidth: 300 // set a correct maxWidth ) child: Text( 'Long Long Long Long Looong Loooooooooooong', overflow: TextOverflow.ellipsis, ),)
You can use :
MediaQuery.of(context).size.width
to get the width of the screen of your phone/tablet.
You can use the padding property of the Container
you have holding the Text
widget to reduce the max size it will take:
Container( margin: EdgeInsets.only(left: 80, right: 80), color: Colors.red, child: Text('Long Long Long Long Long Long Long Long Text', softWrap: false, overflow: TextOverflow.ellipsis, ),),