是否可以使我的文字正常,我的意思是单词之间没有空格?有没有一种方法可以通过分隔单词来将单词包装在下一行上?
这是我的文字部分代码。
Widget textSection({String leadingTitle, String title, String content, BuildContext context}) {
return Row(
children: <Widget>[
Material(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)),
color: Colors.red,
child: Container(
padding: EdgeInsets.all(5.0),
child: Text(leadingTitle,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18.0)),
),
),
SizedBox(
width: 10.0,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
text: content,
textAlign: TextAlign.justify,
style: TextStyle(
fontFamily: 'verdana', color: Colors.black, fontSize: 14),
)
],
),
)
],
);
}
将代码更改为:
Widget textSection({String leadingTitle, String title, String content,
BuildContext context}) {
return Row(
children: <Widget>[
Material(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)),
color: Colors.red,
child: Container(
padding: EdgeInsets.all(5.0),
child: Text(leadingTitle,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18.0)),
),
),
SizedBox(
width: 10.0,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
text: content,
//this was TextAlign.justify
textAlign: TextAlign.left, // will now left justify your text
style: TextStyle(
fontFamily: 'verdana', color: Colors.black, fontSize: 14),
)
],
),
)
],
);
}