简体   繁体   English

Flutter 长文本特征线

[英]Flutter Long Text breakline

I have a long text that doesn't break line.我有一个不断行的长文本。 I suspect the wrap widget is giving this problem.我怀疑 wrap 小部件出现了这个问题。

文字截图

Here's my code这是我的代码

SafeArea(
    child: SingleChildScrollView(
        physics: ScrollPhysics(),
        child: Container(
          child: ColumnSuper(
              innerDistance: -0.5,
              alignment: Alignment.topCenter,
              children: [
                Container(
                  width: MediaQuery.of(buildContext).size.width,
                  child: Wrap(children: [
                    GestureDetector(
                      onTap: () => checkNav(buildContext, linkProtection),
                      child: Container(
                        alignment: ali,
                        margin: margin,
                        padding: padding,
                        decoration: BoxDecoration(
                          border: border,
                          color: backgroundColor,
                          borderRadius: BorderRadius.circular(borderRadius),
                        ),
                        child: Text(
                          """$text""",
                          maxLines: 5,
                          textAlign: TextAlign.start,
                          overflow: TextOverflow.ellipsis,
                          style: TextStyle(
                              color: titleColor,
                              fontSize: titleSize * 1.2,
                              height: titleLineHeight,
                              letterSpacing: titleSpa,
                              fontStyle: titleStyle,
                              decoration: titleDecoration,
                              fontWeight: titleWeight),
                        ),
                      ),
                    ),
                  ]),
                ),
              ]),
        )),
  );

I tried also to put expanded before the Text widget but nothing happens.我也尝试将扩展放在 Text 小部件之前,但没有任何反应。

try to set softWrap property of Text widget true:尝试将 Text 小部件的softWrap属性设置为 true:

Text(
     """$text""",
     maxLines: 5,
     textAlign: TextAlign.start,
     overflow: TextOverflow.ellipsis,
     softWrap: true,
     style: TextStyle(
     color: Colors.green,
   ),
 ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM