我有一个不间断的长文本。我怀疑自动包装小部件正在解决此问题。
这是我的代码
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小部件之前放置扩展,但是什么也没发生。
答案 0 :(得分:0)
尝试将“文本”小部件的softWrap
属性设置为true:
Text(
"""$text""",
maxLines: 5,
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
softWrap: true,
style: TextStyle(
color: Colors.green,
),
),