flutter 代码模板_实时模板-Flutter

flutter 代码模板

Welcome! Today we will learn about live templates for flutter.

欢迎! 今天,我们将学习有关抖动的实时模板。

Recently I haven’t written many blogs but I have been blogging on Instagram.

最近,我没有写很多博客,但是我一直在Instagram上写博客。

Make sure you check out keyboard shortcuts-

确保您签出键盘快捷键 -

开始吧 (Lets start)

If you are checking out this blog, then most probably you are a programmer. Even if you don’t know flutter, this will be useful for you.

如果您正在查看此博客,则很可能您是程序员。 即使您不了解抖动,这对您也很有用。

There is one thing which most of have in common- We don’t like writing the same code again and again. That is also why we love widgets in flutter and those beautiful flutter packages.

大多数人有一个共同点- 我们不喜欢一次又一次地编写相同的代码。 这就是为什么我们喜欢flutter和那些漂亮的flutter包中的小部件的原因。

那么什么是实时模板? (So what are live templates?)

Live templates are used to insert common constructs into your code, such as loops, conditions, various declarations, or print statements.

实时模板用于将常见的构造插入代码中,例如循环,条件,各种声明或打印语句。

Mostly for repeatable code blocks.

主要用于可重复的代码块。

Now enough of theory!! Lets jump to the practical part.

现在足够理论了! 让我们跳到实际的部分。

以下是一些用于抖动的实时模板: (Here are some live templates for flutter:)

0.创建一个无状态小部件 (0. Create a stateless widget)

Image for post

1.创建一个有状态的小部件 (1. Create a stateful widget)

Image for post

2.导航到另一个屏幕 (2. Navigate to another screen)

Image for post

3.导航到另一个屏幕并清除以前的屏幕堆栈 (3. Navigate to another screen and clear previous screens stack)

Image for post

4.增加垂直间隙 (4. Add a vertical gap)

Image for post

5.添加水平间隙 (5. Add a horizontal gap)

Image for post

6.创建一个For循环 (6. Create a For loop)

Image for post

7.迭代数组 (7. Iterating an array)

Image for post

Added on 4th July 2020-

添加于2020年7月4日-

8. Close current screen

8.关闭当前屏幕

Image for post

9. Add delay

9.增加延迟

Image for post

These are some of the most common used templates.

这些是一些最常用的模板。

You can also create your own live templates based on block of code you use repeatedly in your favourite IDE.

您还可以根据在喜爱的IDE中重复使用的代码块创建自己的实时模板。

Live templates are not restricted to any specific framework or language

实时模板不限于任何特定框架或语言

For android studio-

对于Android Studio-

//Navigate
Abbreviation- navigate


Navigator.push(
        context,
        MaterialPageRoute(
            builder: (context) =>$Page$(),
        ),
    );


//Navigate and clear stack
Abbreviation- navigateClearStack


Navigator.pushAndRemoveUntil(
  context,
  MaterialPageRoute(
    builder: (context) => $ClassName$(),
  ),
  (Route<dynamic> route) => false,
);




//Add height gap
Abbreviation- gaph


SizedBox(height: $height$),




//Add width gap
Abbreviation- gapv


SizedBox(width: $width$),




//Close screen
Abbreviation- pop


Navigator.pop(context);




//Delay
Abbreviation- delay


await Future.delayed(Duration(seconds: $seconds$));

Comment below any more live templates which you think should be added to the list

在您认为应该添加到列表中的其他实时模板下方发表评论

Thank you for staying till the end

谢谢你一直待到最后

更多的博客- (More flutter blogs-)

I will be posting more about flutter, so stay tuned :)

我将发布更多有关颤振的信息,敬请期待:)

翻译自: https://medium.com/swlh/live-templates-flutter-6e48683e14e0

flutter 代码模板

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值