toly-flutter / flutter_journey

25 stars 2 forks source link

+ 0001 文字后面跟着个icon(如图黄色框),如何做到文字短的时候跟随,文字长的时候,居右? #4

Open toly1994328 opened 4 years ago

toly1994328 commented 4 years ago

image

toly1994328 commented 4 years ago
    var text=Text("张风捷特烈"*10,overflow: TextOverflow.ellipsis,maxLines: 1,);
    var box=Container(
      width: 20,
      height: 20,
      color: Colors.blue,
    );

    return Container(
      width: 300,
      height: 100,
      color: Colors.cyanAccent.withAlpha(11),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
       text, box,
      ],),
    );
toly1994328 commented 4 years ago

791571985718_ pic 821571985844_ pic

ashamp commented 4 years ago

奥森!