Live Template撸码利器

本文介绍了如何利用IntelliJ IDEA和Android Studio的代码补全功能提高编程效率。通过创建和使用自定义的Live Templates,可以在输入少量字符后自动生成常用代码块,例如在Dart文件中输入'stateful'即可快速生成StatefulWidget的模板代码,简化Android开发中Adapter的抽象方法实现过程。
摘要由CSDN通过智能技术生成

参考:https://www.jianshu.com/p/488f2d73e71d

手动输入代码太辛苦, 拼敲键盘速度? 赶快试用代码补全功能吧。
IntelliJ idea和Android Studio都支持代码自动补全功能, 如上面所示的几个场景。 在工作中可以把常用的代码块总结到模板里, 输入几个字符自动生成代码,从而提高撸码效率;
在这里插入图片描述

例如在创建dart文件后, 文件内容是空的。 这时有代码模块就方便多了, 在文件中输入stateful后点击回车代码就出来了。

import 'package:flutter/material.dart';

class $CUSTOMWIDGET$ extends StatefulWidget {
  $CUSTOMWIDGET$({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值