StatelessWidget with filename
VSCode snippet - The improved statelessW snippet
- Create a snippet file for your project or add it to your global VSCode snippets
- For project specific create the file:
.vscode/*.code-snippets
- Add the code below inside of some curly brackets
{}
- Then type
stlsnamed
to add the snippet
"StatelessWidget with filename": {
"prefix": [
"stlsnamed"
],
"body": [
"import 'package:flutter/material.dart';",
"",
"class ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} extends StatelessWidget {",
" const ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}({super.key});",
"",
" @override",
" Widget build(BuildContext context) {",
" return ${1:Container()};",
" }",
"}",
""
],
"description": "Creates StatelessWidget which shares the name of the file"
},