File tree Expand file tree Collapse file tree 3 files changed +56
-4
lines changed Expand file tree Collapse file tree 3 files changed +56
-4
lines changed Original file line number Diff line number Diff line change 1- ## *** *
1+ ## ** Text**
2+
3+ >
4+ 单一样式的文本,文本可多行显示,也可能全部显示在同一行上
5+ * 默认会继承最接近控件的DefaultTextStyle
6+ * 最基本的文本组件
7+
8+ ### 构造方法
9+
10+ ``` dart
11+ Text(this.data, {
12+ Key key,
13+ this.style,
14+ this.textAlign,
15+ this.textDirection,
16+ this.locale,
17+ this.softWrap,
18+ this.overflow,
19+ this.textScaleFactor,
20+ this.maxLines,
21+ this.semanticsLabel,
22+ })
23+ ```
24+
25+ ### 属性介绍
26+ * data: Text显示的文本,必选参数
27+ * style: 文本样式
28+ * textAlign: 文本对齐方式
29+ * textDirection: 文本显示方向
30+ * maxLines: 文本最多显示几行
31+ * overflow: 文本溢出显示的截断方式
32+ * textScaleFactor: 文本缩放比例
Original file line number Diff line number Diff line change @@ -18,7 +18,28 @@ class _IndexState extends State<Index> {
1818 title: Text ('Text' ),
1919 ),
2020 body: Center (
21- child: Text ('更新中' ),
21+ child: Column (
22+ mainAxisAlignment: MainAxisAlignment .center,
23+ crossAxisAlignment: CrossAxisAlignment .start,
24+ children: < Widget > [
25+ Container (
26+ width: double .infinity,
27+ child: Text (
28+ '文本使用了TextAlign.end' ,
29+ textAlign: TextAlign .end,
30+ style: TextStyle (
31+ fontSize: 20.0 ,
32+ color: Colors .redAccent
33+ ),
34+ ),
35+ ),
36+ Text (
37+ '文本设置maxLines:2,overflow:TextOverflow.ellipsis,文本最多显示两行,超过两行以省略号方式处理' ,
38+ maxLines: 2 ,
39+ overflow: TextOverflow .ellipsis,
40+ )
41+ ],
42+ ),
2243 ),
2344 );
2445 }
Original file line number Diff line number Diff line change 11import 'package:flutter/material.dart' ;
22import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp;
3- // import 'demo.dart' as Demo;
3+ import 'demo.dart' as Demo;
44
55class Index extends StatefulWidget {
66 static String title = 'Text' ;
@@ -19,7 +19,7 @@ class _IndexState extends State<Index> {
1919 originCodeUrl: Index .originCodeUrl,
2020 mdUrl: Index .mdUrl,
2121 demoChild: [
22- // Demo.Index(),
22+ Demo .Index (),
2323 ],
2424 );
2525 }
You can’t perform that action at this time.
0 commit comments