美文网首页
VSCode编辑自己的flutter代码块

VSCode编辑自己的flutter代码块

作者: XH小子 | 来源:发表于2022-02-09 14:19 被阅读0次

Code-> 首选项->用户片段->dart
vscode会生成dart.json文件
编辑dart.json文件

"create tdf flutter page": {
        "prefix": "tdfflutterpage",
        "body": [
            "import 'package:flutter/material.dart';",
            "import 'package:tdf_router_anno/router/router_anno.dart';",
            "@TZRouter(path: ${1:path}, note: ${2:note})",
            "class ${3:name} extends StatefulWidget {",
            "final Map params;",
            "$3(this.params);",
            "",
            "\t@override",
            "State<$3> createState() => _$3State();",
            "}",
            "",
            "class _$3State extends State<$3> {",
            "\t@override",
            "\tWidget build(BuildContext context) {",
            "\t\treturn Container();",
            "}",
            "}",
        ],
        "description": "TDFFlutterPage"
    },

create tdf flutter page这个是代码块的简介,在输入的时候会显示


image.png

"prefix": "tdfflutterpage",是生成代码块输入的简写。

image.png
${1:path} ${2:note}${3:name},"\t@override",
这个为将要替换的内容,$3为${3:name}一起替换的内容,\t为两个空格

相关文章

网友评论

      本文标题:VSCode编辑自己的flutter代码块

      本文链接:https://www.haomeiwen.com/subject/nrmwkrtx.html