当前位置:网站首页>10 个派上用场的 Flutter 小部件
10 个派上用场的 Flutter 小部件
2022-06-09 10:27:00 【华为云】
尝试学习一门新语言可能会令人恐惧和厌烦。很多时候,我们希望我们知道早先存在的某些功能。在今天的文章中,我将告诉你我希望早点知道的最方便的几个Flutter小部件。
Spacer
Spacer 创建一个可调整的空白空间,它占据 Flex 容器中小部件之间的任何剩余空间,例如行或列。
Row( children: const <Widget>[ Text('Begin'), Spacer(), // Defaults to a flex of one. Text('Middle'), // Gives twice the space between Middle and End than Begin and Middle. Spacer(flex: 2), Text('End'), ], ),在创建带有图标的按钮时,此小部件取代了使用行的需要。您必须提供图标和标签。
TextButton.icon( onPressed: () {}, icon: Icon(Icons.home), label: Text('Home') ),Wrap
它根据提供的方向值水平或垂直显示其子项。它可以用来代替 Gridview。这个小部件是响应式的,无需做太多就可以适应不同的屏幕尺寸。
Wrap( direction: Axis.horizontal, alignment: WrapAlignment.start, spacing: 2.0, runSpacing: 3.0, children: [], )AnimatedSwitcher
这个小部件动画一个新的小部件来代替另一个。它提供了一个很好的过渡,使应用程序非常流畅。始终为其子小部件添加一个键以确保其正常工作。
SafeArea
此小部件为您的小部件添加填充,确保您的应用不会与操作系统和设备显示功能(如状态栏)发生冲突。
SafeArea(child: Container())RefreshIndicator
将可滚动的小部件作为一个孩子。当孩子被过度滚动时,动画圆形进度指示器会淡入视图并调用未来来更新可滚动的内容。
RefreshIndicator(child: ListView(), onRefresh: () async {}),RichText
这允许我们在同一个句子或段落上显示具有不同样式的文本。您可以包含内联链接、下划线文本、彩色文本等等。
Transform
这个小部件将您的动画游戏提升到一个全新的水平。它可以实现简单的动画,如旋转和缩放到更复杂的动画,如 3D 和倾斜动画。它提供了有用命名的构造函数,例如旋转、缩放和平移,以便快速实现。
InteractiveViewer
在小部件上引入缩放、平移、拖动和捏合功能的最简单方法。它可以根据您的需要高度定制。
Flow
这个小部件利用转换的力量来提供很酷的动画。它是您必须在实际中看到以了解其功能的小部件之一。查看以获取更多见解。
Chip
这是一个简单的小部件,以有组织的方式和精美的方式显示简单的数据。它有几个变体,例如InputChip、ChoiceChip、FilterChip和ActionChip。
Chip( avatar: CircleAvatar( backgroundColor: Colors.grey.shade800, child: const Text('AB'), ), label: const Text('Aaron Burr'), )现在您知道了一些非常酷的小部件,让我们为更好的使用Flutter加油吧。
边栏推荐
- float-float 模拟CPU和GPU上double双精度计算
- [机缘参悟-20]:鬼谷子-反应篇-动静之术、说听结合、沉默是金
- Network planning | units of each layer in OSI model
- Flink CDC + Hudi 海量数据入湖在顺丰的实践
- 全局组织结构控制之抢滩登陆
- crash问题
- [image enhancement] image enhancement based on sparse representation and regularization with matlab code
- 全网详细接口测试ApiPost详细教程(实战),吐血整理
- How to realize face verification quickly and accurately?
- 建造者模式
猜你喜欢

肆拾伍- 正则表达式 (?=pattern) 以及 (?!pattern)

33 - nodejs simple proxy pool (it's estimated that it's over) the painful experience of using proxy by SuperAgent and the need to be careful

Daily question -1232 Dotted line

Web development exchange, web development example tutorial

Comptage du réseau | unités de chaque couche du Modèle OSI

文档书写规范

MOFs, metal organic framework materials of folate ligands, are loaded with 5-fluorouracil, sidabelamine, taxol, doxorubicin, daunorubicin and other drugs

5. 逆波兰表示法、三元表达式、四元表达式

叁拾叁- NodeJS简单代理池(估计完了吧)SuperAgent 使用 Proxy 的惨痛经历 及做事要细心

论文阅读 (54):DeepFool: A Simple and Accurate Method to Fool Deep Neural Networks
随机推荐
Interaction between C language and Lua (practice 2)
米尔嵌入式CPU模组亮相工业控制技术研讨会
[email protected]负载5-氟尿嘧啶|[email protected]装载5
Forty five - regular expressions (? =pattern) and (?! pattern)
你知道多少,深度解析,值得收藏
全局组织结构控制之抢滩登陆
[go] introduction to exp
Qt-Char实现动态波形显示
Simple example of C # picture verification code
Dotnet core can also coordinate distributed transactions!
叁拾肆- sklearn 根据样本对文本情绪进行分类
How much do you know, deep analysis, worth collecting
flutter setState() called after dispose()
merge sort
Amazing SQL query experience, group by slow query optimization!
Matlab related function knowledge points (III) -floor function + dot division operator + matrix index rules
Web SSH client shwifty
计网 | OSI模型中各层单位
母带编辑制作工具WaveLab 11 Pro
Is it safe for the securities company with the lowest fees to open an account