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

查看:33
本文介绍了如何在 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天全站免登陆