Skip to content

Commit 45e6523

Browse files
ZfinixNash0x7E2
authored andcommitted
feat(sinppets): added support for gridview
1 parent 37d5a64 commit 45e6523

File tree

2 files changed

+62
-13
lines changed

2 files changed

+62
-13
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Awesome Flutter Snippets is a collection of commonly used Flutter classes and me
2121
| `customPainter` | Custom Painter | Used for creating custom paint |
2222
| `listViewB` | ListView.Builder | Creates a scrollable, linear array of widgets that are created on demand.Providing a non-null `itemCount` improves the ability of the `ListView` to estimate the maximum scroll extent. |
2323
| `listViewS` | ListView.Separated | Creates a fixed-length scrollable linear array of list 'items' separated by list item 'separators'. |
24+
| `gridViewB` | GridView.Builder | Creates a scrollable, 2D array of widgets that are created on demand. Providing a non-null `itemCount` improves the ability of the `GridView` to estimate the maximum scroll extent. |
25+
| `gridViewC` | GridView.Count | Creates a scrollable, 2D array of widgets with a fixed number of tiles in the cross axis.
26+
| `gridViewE` | GridView.Extent | Creates a scrollable, 2D array of widgets with tiles that each have a maximum cross-axis extent.
2427
| `customScrollV` | Custom ScrollView | Creates a `ScrollView` that creates custom scroll effects using slivers. If the `primary` argument is true, the `controller` must be null. |
2528
| `streamBldr` | Stream Builder | Creates a new `StreamBuilder` that builds itself based on the latest snapshot of interaction with the specified `stream` |
2629
| `animatedBldr` | Animated Builder | Creates an Animated Builder. The widget specified to `child` is passed to the `builder` |
@@ -59,6 +62,11 @@ At this time, there are no known issues. If you discover a bug or would like to
5962

6063
## Release Notes
6164

65+
### 3.0.1
66+
- Support for `Listview.builder`
67+
- Support for `GridView.count`
68+
- Support for `GridView.extent`
69+
6270
### 3.0.0
6371
- Update all widgets to null safety
6472
- Update engine to `1.56.0`

snippets/snippets.json

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"body": [
2020
"class ${1:name} extends StatefulWidget {",
2121
" ${1:name}({Key? key}) : super(key: key);\n",
22-
" @override",
22+
" @override",
2323
" _${1:WidgetName}State createState() => _${1:WidgetName}State();",
2424
"}\n",
2525
"class _${1:index}State extends State<${1:index}> {",
@@ -79,7 +79,7 @@
7979
"InitState ": {
8080
"prefix": "initS",
8181
"body": [
82-
"@override",
82+
"@override",
8383
"void initState() { ",
8484
" super.initState();",
8585
" ${0:}",
@@ -158,6 +158,47 @@
158158
],
159159
"description": "Creates a fixed-length scrollable linear array of list 'items' separated by list item 'separators'."
160160
},
161+
"GridView.Builder": {
162+
"prefix": "gridViewB",
163+
"body": [
164+
"GridView.builder(",
165+
" gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(",
166+
" crossAxisCount: ${1:2},",
167+
" ),",
168+
" itemCount: ${2:2},",
169+
" itemBuilder: (BuildContext context, int index) {",
170+
" return ${3:};",
171+
" },",
172+
"),"
173+
],
174+
"description": "Creates a scrollable, 2D array of widgets that are created on demand. Providing a non-null `itemCount` improves the ability of the [GridView] to estimate the maximum scroll extent."
175+
},
176+
"GridView.Count": {
177+
"prefix": "gridViewC",
178+
"body": [
179+
"GridView.count(",
180+
" crossAxisSpacing: ${1:1},",
181+
" mainAxisSpacing: ${2:2},",
182+
" crossAxisCount: ${3:2},",
183+
" children: <Widget> [",
184+
" ${4:}",
185+
" ],",
186+
"),"
187+
],
188+
"description": "Creates a scrollable, 2D array of widgets with a fixed number of tiles in the cross axis."
189+
},
190+
"GridView.Extent": {
191+
"prefix": "gridViewE",
192+
"body": [
193+
"GridView.extent(",
194+
" maxCrossAxisExtent: ${1:2},",
195+
" children: <Widget> [",
196+
" ${2:}",
197+
" ],",
198+
"),"
199+
],
200+
"description": "Creates a scrollable, 2D array of widgets with tiles that each have a maximum cross-axis extent."
201+
},
161202
"Custom Scroll View": {
162203
"prefix": "customScrollV",
163204
"body": [
@@ -314,12 +355,12 @@
314355
"description": "A source of asynchronous data events. A stream can be of any data type <T>"
315356
},
316357
"Subject": {
317-
"prefix": "subj",
318-
"body": [
319-
"Stream<${1:type}> get ${2:name} => _${2:name}Subject.stream;",
320-
"final _${2:name}Subject = BehaviorSubject<${1:type}>();"
321-
],
322-
"description": "A BehaviorSubject is also a broadcast StreamController which returns an Observable rather than a Stream."
358+
"prefix": "subj",
359+
"body": [
360+
"Stream<${1:type}> get ${2:name} => _${2:name}Subject.stream;",
361+
"final _${2:name}Subject = BehaviorSubject<${1:type}>();"
362+
],
363+
"description": "A BehaviorSubject is also a broadcast StreamController which returns an Observable rather than a Stream."
323364
},
324365
"toString": {
325366
"prefix": "toStr",
@@ -349,10 +390,10 @@
349390
"description": "Import Flutter Cupertino package"
350391
},
351392
"flutter_test Package": {
352-
"prefix": "importFT",
353-
"body": "import 'package:flutter_test/flutter_test.dart';",
354-
"description": "Import flutter_test package"
355-
},
393+
"prefix": "importFT",
394+
"body": "import 'package:flutter_test/flutter_test.dart';",
395+
"description": "Import flutter_test package"
396+
},
356397
"Material App": {
357398
"prefix": "mateapp",
358399
"description": "Create a MaterialApp",
@@ -454,4 +495,4 @@
454495
],
455496
"description": "Create a testWidgets function"
456497
}
457-
}
498+
}

0 commit comments

Comments
 (0)