1
+ {
2
+ // Place your snippets for dart here. Each snippet is defined under a snippet name and has a prefix, body and
3
+ // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
4
+ // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label }, ${2:another} for placeholders. Placeholders with the
5
+ // same ids are connected.
6
+ // Example:
7
+ // "Print to console": {
8
+ // "prefix": "log",
9
+ // "body": [
10
+ // "console.log('$1');",
11
+ // "$2"
12
+ // ],
13
+ // "description": "Log output to console"
14
+ // },
15
+
16
+ "创建AnimatedBuilder" : {
17
+ "prefix" : " bab" ,
18
+ "body" : [
19
+ " new AnimatedBuilder(" ,
20
+ " animation: $1," ,
21
+ " child: $1," ,
22
+ " builder: (BuildContext context, Widget child) {" ,
23
+ " return Container();" ,
24
+ " }," ,
25
+ " )," ,
26
+ ],
27
+ "description" : " 创建AnimatedBuilder"
28
+ },
29
+ "创建Build()方法" : {
30
+ "prefix" : " bu" ,
31
+ "body" : [
32
+ " @override" ,
33
+ " Widget build(BuildContext context) {" ,
34
+ " return $1;" ,
35
+ " }" ,
36
+ ],
37
+ "description" : " 创建Build()方法"
38
+ },
39
+ "创建FutureBuilder" : {
40
+ "prefix" : " bufb" ,
41
+ "body" : [
42
+ " new FutureBuilder(" ,
43
+ " future: $1," ,
44
+ " initialData: $1," ,
45
+ " builder: (BuildContext context, AsyncSnapshot snapshot) {" ,
46
+ " return $1;" ,
47
+ " }," ,
48
+ " );" ,
49
+ ],
50
+ "description" : " 创建FutureBuilder"
51
+ },
52
+ "创建LayoutBuilder" : {
53
+ "prefix" : " bulb" ,
54
+ "body" : [
55
+ " new LayoutBuilder(" ,
56
+ " builder: (BuildContext context, BoxConstraints constraints) {" ,
57
+ " return $1;" ,
58
+ " }," ,
59
+ " );" ,
60
+ ],
61
+ "description" : " 创建LayoutBuilder"
62
+ },
63
+ "创建OrientationBuilder" : {
64
+ "prefix" : " buob" ,
65
+ "body" : [
66
+ " new OrientationBuilder(" ,
67
+ " builder: (BuildContext context, Orientation orientation) {" ,
68
+ " return Container();" ,
69
+ " }," ,
70
+ " );" ,
71
+ ],
72
+ "description" : " 创建OrientationBuilder"
73
+ },
74
+ "创建StatefulBuilder" : {
75
+ "prefix" : " bustf" ,
76
+ "body" : [
77
+ " new StatefulBuilder(" ,
78
+ " builder: (BuildContext context, setState) {" ,
79
+ " return $1;" ,
80
+ " }," ,
81
+ " );" ,
82
+ ],
83
+ "description" : " 创建StatefulBuilder"
84
+ },
85
+ "创建StreamBuilder" : {
86
+ "prefix" : " bustr" ,
87
+ "body" : [
88
+ " new StreamBuilder(" ,
89
+ " stream: $1," ,
90
+ " initialData: $2," ,
91
+ " builder: (BuildContext context, AsyncSnapshot snapshot) {" ,
92
+ " return $3;" ,
93
+ " }," ,
94
+ " );" ,
95
+ ],
96
+ "description" : " 创建StreamBuilder"
97
+ },
98
+ "创建GridView.count" : {
99
+ "prefix" : " gv" ,
100
+ "body" : [
101
+ " new GridView.count(" ,
102
+ " // 创建几列" ,
103
+ " crossAxisCount: $1," ,
104
+ " // Axis.horizontal表示横向滑动,scrollDirection: Axis.vertical表示纵向滑动" ,
105
+ " scrollDirection: Axis.vertical," ,
106
+ " // 列之间的间距" ,
107
+ " crossAxisSpacing: $2," ,
108
+ " // 行之间的间距" ,
109
+ " mainAxisSpacing: $3," ,
110
+ " // 默认false 是否根据子孩子的宽高自动包裹item自身" ,
111
+ " shrinkWrap: false," ,
112
+ " // true表示数据倒序排列 false表示顺序排列" ,
113
+ " reverse: false," ,
114
+ " // 子孩子的比例" ,
115
+ " childAspectRatio: $4," ,
116
+ " // 设置子孩子item,这里传入子孩子控件" ,
117
+ " children: $5," ,
118
+ " );" ,
119
+ ],
120
+ "description" : " 创建GridView.count"
121
+ },
122
+ "创建 Inherited" : {
123
+ "prefix" : " inh" ,
124
+ "body" : [
125
+ " class $1 extends InheritedWidget {" ,
126
+ " $1({Key key, this.child}) : super(key: key, child: child);" ,
127
+ " " ,
128
+ " final Widget child;" ,
129
+ " " ,
130
+ " static $1 of(BuildContext context) {" ,
131
+ " return (context.inheritFromWidgetOfExactType($1)as $1);" ,
132
+ " }" ,
133
+ " " ,
134
+ " @override" ,
135
+ " bool updateShouldNotify( $1 oldWidget) {" ,
136
+ " return true;" ,
137
+ " }" ,
138
+ " }" ,
139
+ ],
140
+ "description" : " 创建 Inherited"
141
+ },
142
+ }
0 commit comments