Some Friends who use Flutter have a question, whether Android Studio or Intellij IDEA, they are not many of the shortcuts .Some friends are using the VSCode, maybe you can find the plugin to use, but it is not helpful for you. When you write some codes that you use every day, you can't use the shortcut to generate the code you want. So I wrote the common Flutter code live templates, and then you can use it in Android Studio, Intellij IDEA and VSCode.
- 1.Do not make any changes to the settings.jar file, otherwise please re-download the settings.jar flie.
- 2.After importing, if the shortcut is not working, please check whether the code completions are correct in Android Studio or Intellij IDEA.
old version Click menu bar
File → Settings → Editor → General → Code Completion → Case Sensitive Complete → NONE
new version
Click menu bar File → Settings → Editor → General → Code Completion → Delete the check button in front of the Match cases
Import into Android Studio or Intellij IDEA
First open github https://github.com/AweiLoveAndroid/Flutter-learning/tree/master/code_plugins and download the settings.jar
file. The jar flie can be placed in any English file path.
Then, click the menu bar File → Import Settings
, then find the settings.jar
that you had downloaded and import it.
Then select the live template
and live template (schemes)
and click the OK
button.
- Tips: If you don't want to use the keywords
new
, you should download the no_new_keywords/settings.jar file, otherwise you should download the have_new_keywords/settings.jar file.
Import into VSCode
For VSCode users, download the dart.json
file and copy it to C:\ Users\ Administrator \ AppData \ Roaming \ Code \ User \ Snippets \ directory (user is the username in the computer)
. If the file dart.json
already exists, please replace it.
- Tips: If you don't want to use the keywords
new
, you should download the no_new_keywords/dart.json file, otherwise you should download the have_new_keywords/dart.json file.
4.Supported shortcuts
Short keys | Description |
---|---|
bab | Create AnimatedBuilder |
bu | Create Build() |
bufb | Create FutureBuilder |
bulb | Create LayoutBuilder |
buob | Create OrientationBuilder |
bustf | Create StatefulBuilder |
bustr | Create StreamBuilder |
cc | Create CustomClipper |
cen | Create Center |
col | Create Column |
con | Create full Container |
cp | Create your CustomPainter |
csv | CustomScrollView + SliverPadding and its child with padding. |
csv2 | use CustomScrollView + SliverGrid |
gv | Create GridView.count |
inh | Create Inherited |
lv | Create normal ListView |
lvb | Create ListView.builder |
lvd | Create ListView with divider |
lvr | Create RadioListTile |
lvt | Create ListView with more ListTile |
mainstf | Create StatefulWidget |
mainstl | Create StatelessWidget |
me | Create methods |
mep | Create private methods |
row | Create Row |
sb | Create SizedBox |
ssv | Create SingleChildScrollView |
stanim | Create Stateful(with AnimationController) |
stf | Create full StatefulWidget with full lifecycle |
stl | Create StatelessWidget |
svc | Create CustomScrollView |
te | Create normal Text |
5.Some shortcuts usage
mainstf:
mainstl:
stf:
stl:
gv:
lv: