Skip to content

Instantly share code, notes, and snippets.

@hiteshchoudhary
Created May 20, 2019 11:03
Show Gist options
  • Save hiteshchoudhary/02f2c993eadf7e2f9991f90952f58bf9 to your computer and use it in GitHub Desktop.
Save hiteshchoudhary/02f2c993eadf7e2f9991f90952f58bf9 to your computer and use it in GitHub Desktop.
Flutter snippets for stateful and stateless widgets
{
"stateless": {
"prefix": "fless",
"body": [
"import 'package:flutter/material.dart';",
"class $1 extends StatelessWidget {",
"\t@override",
"\tWidget build(BuildContext context) {",
"\t\treturn Container(",
"\t\t\t$2",
"\t\t);",
"\t}",
"}"
]
},
"stateful": {
"prefix": "ffull",
"body": [
"import 'package:flutter/material.dart';",
"class $1 extends StatefulWidget {",
"\t@override",
" \t_$1State createState() => _$1State();",
"}",
"class _$1State extends State<$1> {",
" \t@override",
" \tWidget build(BuildContext context) {",
"\t\treturn Container(",
" \t\t\t$2",
"\t\t);",
"\t}",
"} "
]
}
}
@Shubham-Narkhede
Copy link

	"widgetPaginatedList": {
		"prefix": "WidgetPaginatedList",
		"body": [
			"import 'package:fleet_flutter/widgets/WidgetPaginatedList.dart';",
			"WidgetPaginatedList(",
			"\tpageListController: _pagingController,",
			"\titemBuilder: (item, index) {",
			"\t\treturn Container();",
			"\t},",
			")"
		]
	}

Hi this is my code this works fine but this is a custom widget created for the paginated list. What I want when I use this then I the import sentence put it on the top

import 'package:fleet_flutter/widgets/WidgetPaginatedList.dart';

currently this sentence is called on exact above of that widget so I want to import this on the top of class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment