簡體   English   中英

Flutter 長文本特征線

[英]Flutter Long Text breakline

我有一個不斷行的長文本。 我懷疑 wrap 小部件出現了這個問題。

文字截圖

這是我的代碼

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),
                        ),
                      ),
                    ),
                  ]),
                ),
              ]),
        )),
  );

我也嘗試將擴展放在 Text 小部件之前,但沒有任何反應。

嘗試將 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