Skip to content

Commit 01104c0

Browse files
add widgets
1 parent 70fea08 commit 01104c0

File tree

135 files changed

+5068
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+5068
-412
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,8 @@ app.*.symbols
135135
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
136136
!/dev/ci/**/Gemfile.lock
137137

138-
.idea/
139-
App.framework/
138+
# flutter_fly
139+
flutter_fly/.idea/
140+
flutter_fly/ios/Flutter/App.framework/
140141
Flutter.framework/
141142

142-
/flutter_fly/.idea/
143-

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,3 @@ Github开源地址:[https://github.com/781238222/flutter-do/tree/master/source
176176

177177
28. [人人影视客户端](https://github.com/Vove7/yyets_flutter)
178178

179-
180-

source/flutter/widgets/AboutDialog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
title: 'AboutDialog'
3-
description: '控件介绍'
3+
description: '关于对话框,包含应用程序的图标,名称,版本号和版权,以及用于显示该应用程序使用的软件的许可证的按钮'
44
type: widgets
55
---
66

7+
# AboutDialog
8+
79
AboutDialog用于描述当前App信息,底部提供2个按钮:查看许可按钮和关闭按钮。AboutDialog需要和showAboutDialog配合使用,用法如下:
810

911
```dart
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: 'AboutListTile'
3+
description: '显示”关于信息“的[ListTile],点击弹出AboutDialog'
4+
type: widgets
5+
6+
7+
---
8+
9+
10+
11+
## AboutListTile
12+
13+
用法如下:
14+
15+
```dart
16+
AboutListTile()
17+
```
18+
19+
效果如下:
20+
21+
![](http://img.laomengit.com/image-20200420113543025.png)
22+
23+
什么也没有设置,怎么会出现“About 老孟”?AboutListTile组件的`child`参数,默认显示About+应用程序的名称。
24+
25+
设置`child`参数:
26+
27+
```dart
28+
AboutListTile(
29+
child: Text('About 老孟程序员'),
30+
)
31+
```
32+
33+
效果如下:
34+
35+
![](http://img.laomengit.com/image-20200420114124372.png)
36+
37+
设置`icon`:
38+
39+
```dart
40+
AboutListTile(
41+
icon: FlutterLogo(),
42+
child: Text('About 老孟程序员'),
43+
)
44+
```
45+
46+
效果如下:
47+
48+
![image-20200420114402681](http://img.laomengit.com/image-20200420114402681.png)
49+
50+
设置应用程序属性:
51+
52+
```dart
53+
AboutListTile(
54+
icon: FlutterLogo(),
55+
child: Text('About 老孟程序员'),
56+
applicationName: '老孟程序员',
57+
applicationVersion: 'V1.0.0',
58+
applicationIcon: FlutterLogo(),
59+
applicationLegalese: '专注分享Flutter相关内容')
60+
```
61+
62+
刷新,控件并没有更新,`AboutListTile`控件是有点击属性的,点击弹出AboutDialog控件,这些属性出现在AboutDialog控件上,关于AboutDialog的详细内容请查看AboutDialog控件。
63+
64+
![image-20200420114905231](http://img.laomengit.com/image-20200420114905231.png)
65+
66+
设置`aboutBoxChildren`
67+
68+
```dart
69+
final TextStyle textStyle = Theme.of(context).textTheme.body1;
70+
final List<Widget> aboutBoxChildren = <Widget>[
71+
SizedBox(height: 24),
72+
RichText(
73+
text: TextSpan(
74+
children: <TextSpan>[
75+
TextSpan(
76+
style: textStyle,
77+
text: 'Flutter is Google’s UI toolkit for building beautiful, '
78+
'natively compiled applications for mobile, web, and desktop '
79+
'from a single codebase. Learn more about Flutter at '),
80+
TextSpan(
81+
style: textStyle.copyWith(color: Theme.of(context).accentColor),
82+
text: 'https://flutter.dev'),
83+
TextSpan(style: textStyle, text: '.'),
84+
],
85+
),
86+
),
87+
];
88+
89+
return AboutListTile(
90+
icon: FlutterLogo(),
91+
child: Text('About 老孟程序员'),
92+
applicationName: '老孟程序员',
93+
applicationVersion: 'V1.0.0',
94+
applicationIcon: FlutterLogo(),
95+
applicationLegalese: '专注分享Flutter相关内容',
96+
aboutBoxChildren: aboutBoxChildren,
97+
dense: false,
98+
)
99+
```
100+
101+
效果:
102+
103+
![image-20200420115524929](http://img.laomengit.com/image-20200420115524929.png)
104+
105+
106+
107+
## 总结
108+
109+
此控件通常不会使用,通常会设置一个单独的“关于页面”
110+

source/flutter/widgets/AbsorbPointer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: 'AbsorbPointer'
3-
description: '控件介绍'
2+
title: 'AbsorbPointer | IgnorePointer'
3+
description: '在命中测试期间(不)吸收指针的控件'
44
type: widgets
55

66
---

source/flutter/widgets/Align.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: 'Align|Center'
3-
description: '控件介绍'
3+
description: '布局控件'
44
type: widgets
55
---
66

7-
7+
# Align
88

99
Align和Center控件都是控制子控件位置的控件。
1010

source/flutter/widgets/AlignTransition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'AlignTransition'
3-
description: '控件介绍'
3+
description: '布局变化动画控件'
44
type: widgets
55
---
66

source/flutter/widgets/AnimatedAlign.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: '控件介绍'
44
type: widgets
55
---
66

7-
7+
# AnimatedAlign
88

99
AnimatedAlign组件方便我们构建位置动画,基本用法如下:
1010

source/flutter/widgets/AnimatedBuilder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: '控件介绍'
44
type: widgets
55
---
66

7-
7+
# AnimatedBuilder
88

99
AnimatedBuilder可以让我们轻松的构建动画控件,下面的案例是让flutter logo图片旋转,代码如下:
1010

source/flutter/widgets/AnimatedContainer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: '控件介绍'
44
type: widgets
55
---
66

7-
7+
# AnimatedContainer
88

99
Flutter中很多用于动画的控件,这篇文章介绍动画控件`AnimatedContainer`,我们可以通俗的理解AnimatedContainer是带动画功能的Container,关于Container的详细介绍可以查看[Flutter Widgets 之 Container](https://blog.csdn.net/mengks1987/article/details/104388393),这篇详细介绍了Container的用法。
1010

source/flutter/widgets/AnimatedCrossFade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: '控件介绍'
44
type: widgets
55
---
66

7-
7+
# AnimatedCrossFade
88

99
AnimatedCrossFade组件让2个组件在切换时出现交叉渐入的效果,因此AnimatedCrossFade需要设置2个子控件、动画时间和显示第几个子控件,用法如下:
1010

source/flutter/widgets/AnimatedIcon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: '控件介绍'
44
type: widgets
55
---
66

7-
7+
# AnimatedIcon
88

99
我们都知道Flutter系统中提供了大量的图标,但你是否知道Flutter还提供了很多动画图标,想要使用这些动画图标需要使用AnimatedIcon控件,首先需要设置图标,代码如下:
1010

source/flutter/widgets/AnimatedList.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: '控件介绍'
44
type: widgets
55
---
66

7-
7+
# AnimatedList
88

99
AnimatedList提供了一种简单的方式使列表数据发生变化时加入过渡动画,
1010

source/flutter/widgets/AnimatedModalBarrier.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'AnimatedModalBarrier'
3-
description: '控件介绍'
3+
description: '一个小部件,可防止用户与其自身背后的小部件进行交互,并且可以使用动画颜色值进行配置'
44
type: widgets
55

66
---

source/flutter/widgets/AnimatedOpacity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type: widgets
55

66
---
77

8-
8+
# AnimatedOpacity
99

1010
AnimatedOpacity是一个隐式的动画组件,它可以使子组件变的透明,用法如下:
1111

source/flutter/widgets/AnimatedPadding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type: widgets
55

66
---
77

8-
8+
# AnimatedPadding
99

1010
AnimatedPadding是一个隐式的动画组件,提供动态改变内边距的动画组件,用法如下:
1111

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: 'AnimatedPhysicalModel'
3+
description: '对PhysicalModel组件进行动画'
4+
type: widgets
5+
---
6+
7+
8+
9+
# AnimatedPhysicalModel
10+
11+
AnimatedPhysicalModel组件为动画组件,对PhysicalModel组件进行动画,用法如下:
12+
13+
14+
```dart
15+
@override
16+
Widget build(BuildContext context) {
17+
return Center(
18+
child: Column(
19+
mainAxisSize: MainAxisSize.min,
20+
children: <Widget>[
21+
RaisedButton(
22+
child: Text('动画'),
23+
onPressed: () {
24+
setState(() {
25+
_animated = !_animated;
26+
});
27+
},
28+
),
29+
_buildAnimatedPhysicalModel(),
30+
],
31+
),
32+
);
33+
}
34+
35+
bool _animated = false;
36+
37+
_buildAnimatedPhysicalModel() {
38+
return AnimatedPhysicalModel(
39+
borderRadius: BorderRadius.circular(_animated ? 20 : 10),
40+
shape: BoxShape.rectangle,
41+
color: _animated ? Colors.blue : Colors.red,
42+
elevation: _animated ? 18 : 8,
43+
shadowColor: !_animated ? Colors.blue : Colors.red,
44+
child: Container(
45+
height: 100,
46+
width: 100,
47+
),
48+
duration: Duration(seconds: 1),
49+
);
50+
}
51+
```
52+
53+
效果如下:
54+
55+
![](http://img.laomengit.com/AnimatedPhysicalModel_1.gif)
56+

source/flutter/widgets/AnimatedPositioned.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type: widgets
55

66
---
77

8-
8+
# AnimatedPositioned
99

1010
AnimatedPositioned是一个隐式的动画组件,提供动态改变位置的动画组件,用法如下:
1111

source/flutter/widgets/AnimatedPositionedDirectional.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type: widgets
55

66
---
77

8-
8+
# AnimatedPositionedDirectional
99

1010
AnimatedPositionedDirectional是一个隐式的动画组件,提供动态改变位置的动画组件,用法如下:
1111

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# AnimatedSize
2+
3+
AnimatedSize是一个动画组件,当指定子组件的尺寸发生变化时,它就会在给定的时间内自动变换其尺寸。
4+
5+
用法如下:
6+
7+
```dart
8+
class _WidgetsDemo extends State<WidgetsDemo>
9+
with SingleTickerProviderStateMixin {
10+
var _height = 100.0;
11+
var _width = 100.0;
12+
var _color = Colors.red;
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return Center(
17+
child: Column(
18+
mainAxisAlignment: MainAxisAlignment.center,
19+
children: <Widget>[
20+
RaisedButton(
21+
onPressed: () {
22+
setState(() {
23+
_height = 200.0;
24+
_width = 200.0;
25+
_color = Colors.blue;
26+
});
27+
},
28+
),
29+
AnimatedSize(
30+
vsync: this,
31+
duration: Duration(seconds: 1),
32+
child: Container(
33+
height: _height,
34+
width: _width,
35+
color: _color,
36+
),
37+
)
38+
],
39+
),
40+
);
41+
}
42+
}
43+
```
44+
45+
效果如下:
46+
47+
![](http://img.laomengit.com/AnimatedSize_1.gif)
48+

source/flutter/widgets/AnimatedSwitcher.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type: widgets
55

66
---
77

8-
8+
# AnimatedSwitcher
99

1010
AnimatedSwitcher在2个或者多个子组件之间切换时使用动画,基本用法如下:
1111

0 commit comments

Comments
 (0)