当前位置: 首页 > news >正文

Flutter 每日翻译之 Widget

Describes the configuration for an [Element].
描述元素的配置

Widgets are the central class hierarchy in the Flutter framework.
组件是 Flutter Framework 层次结构中的中心类

A widget is an immutable description of part of a user interface

控件是用户界面不可变描述的一部分

Widgets can be inflated into elements, which manage the underlying render tree.

控件能被解析到元素列表中,被底层呈现树管理

 Widgets themselves have no mutable state (all their fields must be final).
If you wish to associate mutable state with a widget, consider using a
[StatefulWidget], which creates a [State] object (via
[StatefulWidget.createState]) whenever it is inflated into an element and
incorporated into the tree.

控件自身拥有不可变状态(他们的属性必须是final),如果你希望关联到一个可变状态的控件,请考虑使用[StatefulWidget],创建一个[State] 类(通过StatefulWidget.createState),不管如何,他会被解析成元素合并到树中

A given widget can be included in the tree zero or more times. In particular a given widget can be placed in the tree multiple times. Each time a widget is placed in the tree, it is inflated into an [Element], which means a widget that is incorporated into the tree multiple times will be inflated
multiple times.

给定的小部件可以在树中包含零次或多次。特别是给定的小部件可以多次放置在树中。每次一个小部件被放置在树中,它被解析成一个[Element],这意味着一个多次合并到树中的小部件将被充气
很多次了。

 The [key] property controls how one widget replaces another widget in the tree. If the [runtimeType] and [key] properties of the two widgets are [operator==], respectively, then the new widget replaces the old widget by updating the underlying element (i.e., by calling [Element.update] with the new widget). Otherwise, the old element is removed from the tree, the new widget is inflated into an element, and the new element is inserted into the tree.

[key]属性控制一个小部件如何替换树中的另一个小部件。如果两个小部件的[runtimeType]和[key]属性分别为[operator==],则新小部件依次通过更新底层元素(即通过调用[element])来替换旧小部件。用新的小部件更新)。否则,将从树中删除旧元素,将新小部件解析为元素,并将新元素插入到树中。

[StatefulWidget] and [State], for widgets that can build differently several times over their lifetime.

[StatefulWidget]和[State],用于在其生命周期中可以多次构建不同的小部件。

[InheritedWidget], for widgets that introduce ambient state that can be read by descendant widgets.

这个控件引入环境状态它能够被控件读取

[StatelessWidget], for widgets that always build the same way given a particular configuration and ambient state.

[StatelessWidget],用于在给定特定配置和环境状态时始终以相同方式构建的小部件。

http://www.lryc.cn/news/581465.html

相关文章:

  • Vue+Openlayers加载OSM、加载天地图
  • java学习——guava并发编程练习
  • 【Guava】1.0.设计虚拟机的方向
  • 第一个Flink 程序:词频统计 WordCount(流处理)
  • LeetCode--41.缺失的第一个正数
  • 《Redis》缓存与分布式锁
  • AGV选型指南:AGV智能搬运车智能问答系统助力从技术参数到供应商选择的完整方案
  • Flutter 项目开启 UI 层级虚线(UI Guides)
  • 深度学习篇---简单果实分类网络
  • JAVA 项目找不到符号
  • 零依赖Web数据管理系统:midb轻松管理
  • Node.js EventEmitter 深入解析
  • 数据挖掘:从理论到实践的深度探索
  • C++学习之STL学习:list的模拟实现
  • DTW模版匹配:弹性对齐的时间序列相似度度量算法
  • 处理GET请求:在Web开发中如何处理GET请求
  • 【C语言指南】深入剖析 C 语言递归函数
  • 爬虫-浏览器工具简介
  • ch03 部分题目思路
  • Qt实战:使用QSqlDatabase连接MySQL,并实现增删改查
  • 使用Python将PDF转换成word、PPT
  • 网络编程底层通信(socket)
  • 人工智能安全基础复习用:隐私保护
  • 力扣网编程45题:跳跃游戏II之正向查找方法(中等)
  • 群晖(Synology)存储ext4视频文件删除的恢复方法
  • 基于Pandas和FineBI的昆明职位数据分析与可视化实现(五) - 基于随机森林算法预测职位分类
  • MySQL主从复制与读写分离概述
  • 【AI大模型】Spring AI 基于mysql实现对话持久存储详解
  • Neo4j 综合练习作业
  • 7,TCP服务器