Flutter的文本控件的基本使用
import 'package:flutter/material.dart';
void main(){
runApp(
MaterialApp(
title: "TextDemo",
home: TextDemo(),
)
);
}
class TextDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Text文本控件"),
),
body: Column(
children: <Widget>[
Text(
"红色+23号字+ 加粗",
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
letterSpacing: 6,
fontSize: 23,
),
),
Text("绿色+底部实线+24号字体"
,
style: TextStyle(
color: Colors.green,
decoration: TextDecoration.underline,
fontSize: 24
),
),
Text("顶部虚线上划线+25号字+倾斜字"
,
style: TextStyle(
fontSize: 25,
fontStyle: FontStyle.italic,
decoration: TextDecoration.overline,
decorationStyle: TextDecorationStyle.dashed,
),
),
Text("蓝色+红色的删除线+27号字体",
style: TextStyle(
fontSize: 27,
color: Colors.blue,
decoration: TextDecoration.lineThrough,
),
)
],
),
);
}
}