ElNullElement class

空 Element 实例,通常用于初始化 Element 数组

Inheritance
Available extensions

Properties

brightness Brightness

Available on BuildContext, provided by the FlutterContextExt extension

获取当平台亮度模式
no setter
buildScope BuildScope
A BuildScope whose dirty Elements can only be rebuilt by BuildOwner.buildScope calls whose context argument is an Element within this BuildScope.
no setterinherited
currentBgColor Color

Available on BuildContext, provided by the FlutterContextExt extension

访问当前背景颜色
no setter
currentTextColor Color

Available on BuildContext, provided by the FlutterContextExt extension

访问当前文本样式
no setter
debugDoingBuild bool
Whether the widget is currently updating the widget or render tree.
no setteroverride
debugIsActive bool
Returns true if the Element is active.
no setterinherited
debugIsDefunct bool
Returns true if the Element is defunct.
no setterinherited
depth int
An integer that is guaranteed to be greater than the parent's, if any. The element at the root of the tree must have a depth greater than 0.
no setterinherited
dirty bool
Returns true if the element has been marked as needing rebuilding.
no setterinherited
elIconTheme IconThemeData

Available on BuildContext, provided by the ElIconThemeExt extension

全局图标主题
no setter
elTextTheme ElTextThemeData

Available on BuildContext, provided by the ElTextThemeExt extension

全局文本主题
no setter
hashCode int
The hash code for this object.
no setterinherited
hasHover bool

Available on BuildContext, provided by the FlutterContextExt extension

是否激活了 hover 悬停状态
no setter
hasTap bool

Available on BuildContext, provided by the FlutterContextExt extension

是否激活了 tap 点击状态
no setter
isDark bool

Available on BuildContext, provided by the FlutterContextExt extension

当前环境是否是暗黑模式
no setter
ltr bool

Available on BuildContext, provided by the FlutterContextExt extension

文本方向是否是从左到右
no setter
mounted bool
Whether the Widget this context is associated with is currently mounted in the widget tree.
no setterinherited
owner BuildOwner?
The object that manages the lifecycle of this element.
no setterinherited
renderObject RenderObject?
The render object at (or below) this location in the tree.
no setterinherited
renderObjectAttachingChild Element?
Returns the child of this Element that will insert a RenderObject into an ancestor of this Element to construct the render tree.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size?
The size of the RenderBox returned by findRenderObject.
no setterinherited
slot Object?
Information set by parent to define where this child fits in its parent's child list.
no setterinherited
widget Widget
The configuration for this element.
no setterinherited

Methods

activate() → void
Transition from the "inactive" to the "active" lifecycle state.
inherited
attachNotificationTree() → void
Called in Element.mount and Element.activate to register this element in the notification tree.
inherited
attachRenderObject(Object? newSlot) → void
Add renderObject to the render tree at the location specified by newSlot.
inherited
deactivate() → void
Transition from the "active" to the "inactive" lifecycle state.
inherited
deactivateChild(Element child) → void
Move the given element to the list of inactive elements and detach its render object from the render tree.
inherited
debugDeactivated() → void
Called, in debug mode, after children have been deactivated (see deactivate).
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugExpectsRenderObjectForSlot(Object? slot) bool
Whether the child in the provided slot (or one of its descendants) must insert a RenderObject into its ancestor RenderObjectElement by calling RenderObjectElement.insertRenderObjectChild on it.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
debugGetCreatorChain(int limit) String
Returns a description of what caused this element to be created.
inherited
debugGetDiagnosticChain() List<Element>
Returns the parent chain from this element back to the root of the tree.
inherited
debugVisitOnstageChildren(ElementVisitor visitor) → void
Calls the argument for each child considered onstage.
inherited
dependOnInheritedElement(InheritedElement ancestor, {Object? aspect}) InheritedWidget
Registers this build context with ancestor such that when ancestor's widget changes this build context is rebuilt.
inherited
dependOnInheritedWidgetOfExactType<T extends InheritedWidget>({Object? aspect}) → T?
Returns the nearest widget of the given type T and creates a dependency on it, or null if no appropriate widget is found.
inherited
describeElement(String name, {DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty}) DiagnosticsNode
Returns a description of the Element associated with the current build context.
inherited
describeMissingAncestor({required Type expectedAncestorType}) List<DiagnosticsNode>
Adds a description of a specific type of widget missing from the current build context's ancestry tree.
inherited
describeOwnershipChain(String name) DiagnosticsNode
Adds a description of the ownership chain from a specific Element to the error report.
inherited
describeWidget(String name, {DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty}) DiagnosticsNode
Returns a description of the Widget associated with the current build context.
inherited
detachRenderObject() → void
Remove renderObject from the render tree.
inherited
didChangeDependencies() → void
Called when a dependency of this element changes.
inherited
dispatchNotification(Notification notification) → void
Start bubbling this notification at the given build context.
inherited
doesDependOnInheritedElement(InheritedElement ancestor) bool
Returns true if dependOnInheritedElement was previously called with ancestor.
inherited
elDuration([Duration? duration]) Duration

Available on BuildContext, provided by the ElSyncThemeDurationExt extension

Element UI 只提供普通全局主题对象,不提供动画版本的全局主题,例如 AnimatedTheme, 创建 lerp 动画曲线相当繁琐,你可以查看官方为此写了多少代码 ThemeData.lerp
findAncestorRenderObjectOfType<T extends RenderObject>() → T?
Returns the RenderObject object of the nearest ancestor RenderObjectWidget widget that is an instance of the given type T.
inherited
findAncestorStateOfType<T extends State<StatefulWidget>>() → T?
Returns the State object of the nearest ancestor StatefulWidget widget that is an instance of the given type T.
inherited
findAncestorWidgetOfExactType<T extends Widget>() → T?
Returns the nearest ancestor widget of the given type T, which must be the type of a concrete Widget subclass.
inherited
findDescendantStateOfType<T extends State<StatefulWidget>>([BuildContext? context]) → T?

Available on BuildContext, provided by the FlutterContextExt extension

访问指定类型 State 的后代元素,注意:对于拥有多个子项的 Widget,它只会访问第一条数据并进行递归, 所以在调用此方法前你应当确保直属后代存在目标元素
findRenderObject() RenderObject?
The current RenderObject for the widget. If the widget is a RenderObjectWidget, this is the render object that the widget created for itself. Otherwise, it is the render object of the first descendant RenderObjectWidget.
inherited
findRootAncestorStateOfType<T extends State<StatefulWidget>>() → T?
Returns the State object of the furthest ancestor StatefulWidget widget that is an instance of the given type T.
inherited
forgetChild(Element child) → void
Remove the given child from the element's child list, in preparation for the child being reused elsewhere in the element tree.
inherited
getAncestorElement<T extends Widget>() Element?

Available on BuildContext, provided by the FlutterContextExt extension

通过当前 context,获取最近的目标祖先 Element
getAncestorWidget<T extends Widget>() → T?

Available on BuildContext, provided by the FlutterContextExt extension

通过当前 context,获取最近的目标祖先 Widget
getElementForInheritedWidgetOfExactType<T extends InheritedWidget>() InheritedElement?
Obtains the element corresponding to the nearest widget of the given type T, which must be the type of a concrete InheritedWidget subclass.
inherited
getInheritedWidgetOfExactType<T extends InheritedWidget>() → T?
Returns the nearest widget of the given InheritedWidget subclass T or null if an appropriate ancestor is not found.
inherited
getPosition([BuildContext? context]) Offset

Available on BuildContext, provided by the FlutterContextExt extension

从当前 context 获取元素的坐标位置,你还可以传递另一个 Widget 的 context 作为参数,计算相对坐标
getRect([BuildContext? context]) Rect

Available on BuildContext, provided by the FlutterContextExt extension

从当前 context 获取元素的坐标 + 宽高,你还可以传递另一个 Widget 的 context 作为参数,计算相对坐标
hasAncestorWidget<T extends Widget>() bool

Available on BuildContext, provided by the FlutterContextExt extension

通过当前 context,检查祖先是否存在某个 Widget
inflateWidget(Widget newWidget, Object? newSlot) Element
Create an element for the given widget and add it as a child of this element in the given slot.
inherited
markNeedsBuild() → void
Marks the element as dirty and adds it to the global list of widgets to rebuild in the next frame.
inherited
mount(Element? parent, Object? newSlot) → void
Add this element to the tree in the given slot of the given parent.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performRebuild() → void
Cause the widget to update itself.
inherited
read<T>() → T

Available on BuildContext, provided by the ReadContext extension

Obtain a value from the nearest ancestor provider of type T.
reassemble() → void
Called whenever the application is reassembled during debugging, for example during hot reload.
inherited
rebuild({bool force = false}) → void
Cause the widget to update itself. In debug builds, also verify various invariants.
inherited
select<T, R>(R selector(T value)) → R

Available on BuildContext, provided by the SelectContext extension

Watch a value of type T exposed from a provider, and mark this widget for rebuild on changes of that value.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this element.
inherited
unmount() → void
Transition from the "inactive" to the "defunct" lifecycle state.
inherited
update(covariant Widget newWidget) → void
Change the widget used to configure this element.
inherited
updateChild(Element? child, Widget? newWidget, Object? newSlot) Element?
Update the given child with the given new configuration.
inherited
updateChildren(List<Element> oldChildren, List<Widget> newWidgets, {Set<Element>? forgottenChildren, List<Object?>? slots}) List<Element>
Updates the children of this element to use new widgets.
inherited
updateSlot(Object? newSlot) → void
Called by updateSlotForChild when the framework needs to change the slot that this Element occupies in its ancestor.
inherited
updateSlotForChild(Element child, Object? newSlot) → void
Change the slot that the given child occupies in its parent.
inherited
visitAncestorElements(ConditionalElementVisitor visitor) → void
Walks the ancestor chain, starting with the parent of this build context's widget, invoking the argument for each ancestor.
inherited
visitChildElements(ElementVisitor visitor) → void
Wrapper around visitChildren for BuildContext.
inherited
visitChildren(ElementVisitor visitor) → void
Calls the argument for each child. Must be overridden by subclasses that support having children.
inherited
watch<T>() → T

Available on BuildContext, provided by the WatchContext extension

Obtain a value from the nearest ancestor provider of type T or T?, and subscribe to the provider.

Operators

operator ==(Object other) bool
Compare two widgets for equality.
inherited

Static Properties

instance ElNullElement
final