new Text('Text style',
textAlign: TextAlign.center,
style: new TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.bold,
color: Colors.black,),
overflow: TextOverflow.ellipsis,
),
其中textAlign
是用来控制文本对齐方式,style
控制文本包括字体,颜色,字体大小等样式。
Text文本是没有边距的设置参数,我们使用Container
、Padding
与Text
嵌套使用。
Container
new Container( child: new Text("Container text"),
color: Colors.blue,
margin: const EdgeInsets.all(5.0),
padding: const EdgeInsets.all(5.0),),