Search code examples
fluttertextoverflow

i need to remove this text over flow in flutter. how can i do that?


I am facing error in the Text widget which is in Column.

  body: Padding(
    padding: const EdgeInsets.all(20),
    child: Column(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  widget.songModel.displayNameWOExt,  <------- here is my text
                ),
                Text(
                  widget.songModel.artist.toString(),
                  overflow: TextOverflow.fade,
                ),
              ],
            ),  
      ],
    ),   ), );

This is what happened to me

This is what i need look like


Solution

  • wrap the text with the container and give a specific size to the container after that use overflow: TextOverflow.fade or any other property of "overflow", because these properties only work when you give a size to textfield but you cant give size to textfield so wrap it with container.