Skip to content

Commit 8073e8b

Browse files
committed
feat: FlatButton
1 parent b4b61f3 commit 8073e8b

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed
Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
1-
## ****
1+
## **FlatButton**
2+
3+
>
4+
文本标签按钮
5+
* onPressed回调为null,则该按钮将被禁用
6+
7+
### 构造方法
8+
``` dart
9+
FlatButton({
10+
Key key,
11+
@required VoidCallback onPressed,
12+
ValueChanged<bool> onHighlightChanged,
13+
ButtonTextTheme textTheme,
14+
Color textColor,
15+
Color disabledTextColor,
16+
Color color,
17+
Color disabledColor,
18+
Color highlightColor,
19+
Color splashColor,
20+
Brightness colorBrightness,
21+
EdgeInsetsGeometry padding,
22+
ShapeBorder shape,
23+
Clip clipBehavior = Clip.none,
24+
MaterialTapTargetSize materialTapTargetSize,
25+
@required Widget child,
26+
})
27+
```
28+
29+
### 属性介绍
30+
* onPressed: 点击回调
31+
* textColor:文本颜色
32+
* disabledTextColor:禁用文本颜色
33+
* color:按钮颜色
34+
* disabledColor: 禁用按钮颜色
35+
* highlightColor:长按按钮颜色
36+
* child:按钮中的Widget

lib/widget/common/flatbutton/demo.dart

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,35 @@ class _IndexState extends State<Index> {
1818
title: Text('FlatButton'),
1919
),
2020
body: Center(
21-
child: Text('更新中'),
21+
child: Wrap(
22+
alignment: WrapAlignment.spaceEvenly,
23+
children: <Widget>[
24+
FlatButton(
25+
child: Text('默认按钮'),
26+
onPressed: (){},
27+
textColor: Theme.of(context).primaryColor,
28+
color: Colors.blueGrey,
29+
highlightColor: Colors.blueAccent,
30+
),
31+
FlatButton(
32+
child: Text('默认按钮'),
33+
textColor: Theme.of(context).primaryColor,
34+
disabledColor: Colors.grey,
35+
disabledTextColor: Colors.brown,
36+
),
37+
FlatButton.icon(
38+
icon: Icon(Icons.android,size: 26.0,color: Colors.blueAccent),
39+
label: Text('默认按钮'),
40+
onPressed: (){},
41+
),
42+
FlatButton.icon(
43+
icon: Icon(Icons.account_balance,size: 26.0,color: Colors.greenAccent),
44+
label: Text('默认按钮'),
45+
disabledColor: Colors.grey,
46+
disabledTextColor: Colors.brown,
47+
)
48+
],
49+
),
2250
),
2351
);
2452
}

lib/widget/common/flatbutton/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 = 'FlatButton';
@@ -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)