Flutter开发技巧:Android Studio快速生成Dart文件

自定义文件模板

Android Studio 设置路径:Android Studio | Preferences | 搜索Templates | File and Code Templates | Dart File 设置步骤如下图:

模版代码

import 'package:flutter/material.dart';
/**
 * @author[${USER}]
 * @version[创建日期,${DATE} ${TIME}]
 * @function[功能简介 ${DESCRIPTION}]
 **/
class ${NAME}Page extends StatefulWidget {
const ${NAME}Page({Key? key}) : super(key: key);

 @override
  _${NAME}PageState createState() => _${NAME}PageState();
}

class _${NAME}PageState extends State<${NAME}Page> {

 @override
  Widget build(BuildContext context) {
   return Scaffold(
     appBar: AppBar(
      title: Text("${NAME}"),
    ),
     body: Center(
       child: Column(), 
      )// This trailing comma makes auto-formatting nicer for build methods.
    );
}
}

使用方法

猜你喜欢

转载自blog.csdn.net/BianHuanShiZhe/article/details/131629001