我有以下用于打印文本的小部件:
class NormalText extends StatelessWidget {
final String txt;
NormalText(this.txt) {}
@override
Widget build(BuildContext context) {
return Container(
child: Text(txt,
style: TextStyle(
color: Colors.grey,
fontSize: 20,
fontWeight: FontWeight.bold)));
}
}
但是如果我这样使用它:
NormalText('hello\tworld\t42')
\t 缩进太小。有没有办法增加缩进以占用更多空间?
最佳答案
您可以使用wordSpacing
参数
Text(
'Build some widgets!',
style: TextStyle(
height: 1.2 ,
wordSpacing: 6,
letterSpacing: 1.0,
)
),
关于 flutter : How to increase indentation width of tab '\t' in text,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61897852/