class MyApp extends StatelessWidget { const MyApp({Key key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( title: 'Text文本组件', home: Scaffold( appBar: AppBar( title: Text('Text文本组件'), ), body: Text( 'hello world', style: TextStyle( //字体 //1、将ttf字体文件放到根目录的assets/fonts中, //2、在pubspec.yaml中配置字体路径,同时设置字体类型的名称 // fonts: // - family: fzzqt // fonts: // - asset: assets/fonts/fzzqt.ttf // style: italic //3、在fontFamily后面加上字体名称即可 fontFamily: 'fzzqt', fontSize: 36.0, color: Colors.red, //加粗 fontWeight: FontWeight.bold, //文字修饰 //TextDecoration.lineThrough, TextDecoration.underline,TextDecoration.overline,TextDecoration.none decoration: TextDecoration.overline, //修饰符样式 点虚线 decorationStyle: TextDecorationStyle.dotted, //修饰符颜色 decorationColor: Colors.black, ), ), ), ); } }
部分素材资源来源网站,本站提供免费下载,如有侵权请联系站长马上删除!