Flutter文本未以正确的方式出现在新行上

00jrzges  于 11个月前  发布在  Flutter
关注(0)|答案(2)|浏览(104)

我的Flutter Text小部件没有按照单词之间的空格的方式在新的一行上运行。我期待的是这样的:
没有一个伟大的艺术家能像一个年轻的艺术家那样获得成功。
但我得到的是:myApp
下面是我的问题代码:

class HomePageBodyState extends State<HomePageBody>
{
  @override
  Widget build(BuildContext context)
  {
    return ListView(
      padding: EdgeInsets.all(8),
      children: [
        Column(
          children: [
            Container(
              padding: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 4),
              child:
                Text(
                  ' Non tutti possono diventare dei grandi artisti ma un grande artista può celarsi in chiunque. ',
                  softWrap: true,
                  textAlign: TextAlign.center,
                  style: TextStyle(
                  fontFamily: "Glass",
                  fontSize: 26,
                  ),
              ),
            ),
          ],
        ),
      );
  }

字符串

tvokkenx

tvokkenx1#

您可以使用这行将文本居中:

textAlign: TextAlign.center,

字符串
如果文本应该从左边开始,请删除此选项。

f3temu5u

f3temu5u2#

您可以通过将textAlign属性更改为TextAlign.start来将文本对齐到容器的开头。

Text(
                ' Non tutti possono diventare dei grandi artisti ma un grande artista può celarsi in chiunque.',
                softWrap: true,
                textAlign: TextAlign.start,
                style: TextStyle(
                fontFamily: "Glass",
                fontSize: 26,
                ),
              )

字符串

相关问题