Flutter development tips: Android Studio quickly generates Dart files

Custom file template

Android Studio setting path : Android Studio | Preferences | Search Templates | File and Code Templates | Dart File setting steps are as follows:

template code

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.
    );
}
}

Instructions

Guess you like

Origin blog.csdn.net/BianHuanShiZhe/article/details/131629001