Skip to content

Instantly share code, notes, and snippets.

@Klerith
Last active May 3, 2024 13:38
Show Gist options
  • Save Klerith/08f38332f4db859d3f48a71a5d696391 to your computer and use it in GitHub Desktop.
Save Klerith/08f38332f4db859d3f48a71a5d696391 to your computer and use it in GitHub Desktop.
Dart Snippets
{
// Place your snippets for dart here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Rectángulo Widget": {
"prefix": "rectangulo",
"body": [
"class Rectangulo extends StatelessWidget {",
" @override",
" Widget build(BuildContext context) {",
" return Container(",
" width: 70,",
" height: 70,",
" decoration: BoxDecoration(",
" color: Colors.blue",
" ),",
" );",
" }",
"}",
],
"description": "Log output to console"
},
"Flutter Page": {
"prefix": "fl-page",
"body": [
"import 'package:flutter/material.dart';",
"",
"",
"class ${1:name}Page extends StatelessWidget {",
"",
" @override",
" Widget build(BuildContext context) {",
" return Scaffold(",
" body: Center(",
" child: Text('Hola Mundo'),",
" ),",
" );",
" }",
"}",
],
"description": "Crea una página de flutter fácilmente"
}
}
@csparedes
Copy link

Hola @Klerith , genial el snippet
Y pues como yo soy temático (así decimos quisquilloso decimos en Ecuador XD), dejo el snippet actualizado, como lo hizo @SOY4RIAS

"Flutter Page": {
	"prefix": "fl-page",
	"body": [
		"import 'package:flutter/material.dart';",
		"",
		"class ${TM_FILENAME_BASE/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g} extends StatelessWidget {",
		"  const ${TM_FILENAME_BASE/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g}({Key? key}) : super(key: key);",
		"  @override",
		"  Widget build(BuildContext context) {",
		"    return const Scaffold(",
		"      body: Center(",
		"        child: ${2:Text('Hello World')},",
		"      ),",
		"    );",
		"  }",
		"}",
		
	],
	"description": "Crea una página de flutter fácilmente"
}

Saludos!!!!

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