如何在vscode中包围Flutter小部件 [英] How to surround flutter widget in vscode

查看:476
本文介绍了如何在vscode中包围Flutter小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道Visual Studio代码中是否有快捷方式或扩展名来包围代码块-或更具体地,突出显示小部件名称,然后将小部件子级包围.

Just wondering if there is a shortcut or extension in visual studio code to surround a code block - or more specifically highlight the widget name and then surround that widgets children.

通常是我创建的情况,可以这样说:

Often is the case where I have created, lets say a:

Padding(
  padding: EdgeInsets.all(10.0),
  child: Container(
  ...

但是在写了几本书之后,我想用其他内容将Padding包围起来,例如ColumnRow. 照原样,我需要在Padding之前加上Row( child:前缀,然后向下滚动并添加新的),方括号

But then after some writing, i want to surround that Padding with something else, like a Column or Row. As is, I need to prefix the Padding with Row( child: and then scroll down and add the new ),` bracket

有没有办法只选择Padding然后告诉vs代码我要为此加上前缀,以便为我加上括号?

Is there not a way to just select the Padding and then tell vs code that I am going to prefix this so add the bracket for me?

很确定我已经在IntelliJ中看到了这一点

Pretty sure I have seen this in action in IntelliJ

推荐答案

可以!

Vscode提供了一些重构选项,包括Wrap with Column:

Vscode offer a few refactor options, including Wrap with Column:

只需右键单击小部件,然后按重构".

Just right-click on a widget and press "Refactor".

这篇关于如何在vscode中包围Flutter小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆