How to display ellipsis when the text length overflows in flutter?

I often encounter this kind of problem when drawing UI. According to different scenarios, I will talk about my common solutions:

1. The first is to nest a layer of Container in the outer layer of the Text tag, and specify the width

2. The second is the automatic adaptation mode, which I often use when Row and Column are nested in the outer layer of Text and some layout controls

new Flexible( //长度自适应
  child: new Container(
    padding: new EdgeInsets.only(right: 13.0),
    child: new Text(
      'Text largeeeeeeeeeeeeeeeeeeeeeee',
      overflow: TextOverflow.ellipsis, //长度溢出后显示省略号
      style: new TextStyle(
        fontSize: 13.0,
        fontFamily: 'Roboto',
        color: new Color(0xFF212121),
        fontWeight: FontWeight.bold,
      ),
    ),
  ),
),

Guess you like

Origin blog.csdn.net/qq_25062671/article/details/127975430