Flutter文本显示组件使用的是Text,主要用来显示文本,主要有以下几个重要属性
maxLines:显示行数。
overflow:超出部分的处理方式
style:用来设置样式
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter',
home:Scaffold(
appBar: AppBar(
title: Text("Hello World"),
),
body: Center(
child: Text("你好,Flutter, Flutter文本显示组件使用的是Text,主要用来显示文本Flutter文本显示组件使用的是Text,主要用来显示文本Flutter文本显示组件使用的是Text,主要用来显示文本Flutter文本显示组件使用的是Text,主要用来显示文本",textAlign: TextAlign.left,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize:12,color:Colors.red,decoration: TextDecoration.underline),
),
),
)
);
}
}