文本颤振多行 [英] Flutter Multiline for text

查看:63
本文介绍了文本颤振多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要的是多行文本.我赋予了maxLines的属性,但它仍然在右侧获得RenderFlex溢出错误,因为下一个不会到达第二行,

All I need is my text to be multi-line. Am giving the property of maxLines but its still getting RenderFlex overflowed error to the right as the next is not going to 2nd line,

      Align( alignment: Alignment.bottomCenter,
      child: new ButtonBar(
        alignment: MainAxisAlignment.center,
        children: <Widget>[
          Padding(
            padding: EdgeInsets.all(20.0),
            child: new Text(
              "This is a very bigggggggg text !!!",textDirection: TextDirection.ltr,
              style: new TextStyle(fontSize: 20.0, color: Colors.white),
              maxLines: 2,
            ),
          )
        ],
      ),
    )

推荐答案

请确保父窗口小部件限制了文本的宽度,然后使用溢出和最大行数,例如:

Make sure that the parent widget limits your text's width, and then use overflow and maxlines, e.g.:

Container(
  width: 150,
  child: Text(
    "This text is very very very very very very very very very very very very very very very very very very very very very very very very very long",
    overflow: TextOverflow.ellipsis,
    maxLines: 5,
  ),
),

这篇关于文本颤振多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆