基础Widget
一 Widget基础简介
TODO
:这一part后面再细解
二 文本、字体样式
2.1 文本
常见属性:
- textAlign
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center (
child: Text("Hello World",
textAlign: TextAlign.center,
), // 下面的代码都是替换该位置
),
),
);
}
}
- maxLines
- overflow
Text("Hello World!!! I'm Yangchengfeng" *4,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
- textScaleFactor
Text("Hello World!!!",
textScaleFactor: 2.0,
),
- TextStyle
Text("Hello World!!!",
style: TextStyle(
color: Colors.blue,
fontSize: 19.0,
height: 1.2,
fontFamily: "Courier",
background: new Paint()..color=Colors.yellow,
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.dashed
),
),