1.1 文本字体样式的使用
1.源代码
import 'package:flutter/material.dart';
void main () => runApp(MyApp());
class MyApp extends StatelessWidget{
@override
Widget build(BuildContext context ){
return MaterialApp(
title:'Text widget usage',
home:Scaffold(
body:Center(
child:Text('第一个Flutter程序!'* 5,
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textScaleFactor: 1.5,
style: TextStyle(
fontSize: 20.0,
color: Colors.blue,
decoration: TextDecoration.underline,
decorationColor: Color.fromARGB(120, 125, 20, 20),
decorationStyle: TextDecorationStyle.solid,
height: 1.2,
fontFamily: "Courier",
background: new Paint()..color=Colors.yellow
),
),
),
),
);
}
}
2.解释源代码
import 'package:flutter/material.dart';
void main () => runApp(MyApp());
class MyApp extends StatelessWidget{
@override
Widget build(BuildContext context ){
return MaterialApp(
title:'Text widget usage',
home:Scaffold(
body:Center(
child:Text('第一个Flutter程序!'* 5,
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textScaleFactor: 1.5,
style: TextStyle(
fontSize: 20.0,
color: Colors.blue,
decoration: TextDecoration.underline,
decorationColor: Color.fromARGB(120, 125, 20, 20),
decorationStyle: TextDecorationStyle.solid,
height: 1.2,
fontFamily: "Courier",
background: new Paint()..color=Colors.yellow
),
),
),
),
);
}
}