Skip to content

Commit 06b2db4

Browse files
committed
feat: Text
1 parent 5f9d69c commit 06b2db4

File tree

3 files changed

+56
-4
lines changed

3 files changed

+56
-4
lines changed

docs/widget/common/text/index.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
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: 文本缩放比例

lib/widget/common/text/demo.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

lib/widget/common/text/index.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp;
3-
// import 'demo.dart' as Demo;
3+
import 'demo.dart' as Demo;
44

55
class 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
}

0 commit comments

Comments
 (0)