InheritedContext<T> class abstract

A BuildContext associated to an InheritedProvider.

It an extra markNeedsNotifyDependents method and the exposed value.

Inheritance
Available extensions

Constructors

InheritedContext()

Properties

debugDoingBuild bool
Whether the widget is currently updating the widget or render tree.
no setterinherited
elDefaultColor Color

Available on BuildContext, provided by the ElBuildContextExt extension

访问祖先提供的默认颜色
no setter
elPlaceholderTextStyle TextStyle

Available on BuildContext, provided by the ElBuildContextExt extension

no setter
elRegularTextStyle TextStyle

Available on BuildContext, provided by the ElBuildContextExt extension

no setter
elSecondaryTextStyle TextStyle

Available on BuildContext, provided by the ElBuildContextExt extension

no setter
elTextStyle TextStyle

Available on BuildContext, provided by the ElBuildContextExt extension

no setter
elTheme ElThemeData

Available on BuildContext, provided by the ElBuildContextExt extension

访问自适应主题,如果当前是暗黑模式,则获取注入的暗黑主题,否则获取注入的亮色主题
no setter
elThemeColors Map<ElThemeType, Color>

Available on BuildContext, provided by the ElBuildContextExt extension

no setter
hasFocus bool

Available on BuildContext, provided by the ElEventExt extension

从当前上下文 context 访问最近的 ElEvent 注入的 focus 聚焦状态
no setter
hashCode int
The hash code for this object.
no setterinherited
hasHover bool

Available on BuildContext, provided by the ElEventExt extension

从当前上下文 context 访问最近的 ElEvent 注入的 hover 悬停状态
no setter
hasSelected bool

Available on BuildContext, provided by the ElSelectionExtension extension

小部件是否被选中
no setter
hasTap bool

Available on BuildContext, provided by the ElEventExt extension

从当前上下文 context 访问最近的 ElEvent 注入的 tap 点击状态
no setter
hasValue bool
Whether setState was called at least once or not.
no setter
lg bool

Available on BuildContext, provided by the ElResponsiveExt extension

当前是否处于桌面布局(<=1920)
no setter
md bool

Available on BuildContext, provided by the ElResponsiveExt extension

当前是否处于平板布局(<=1024)
no setter
mounted bool
Whether the Widget this context is associated with is currently mounted in the widget tree.
no setterinherited
owner BuildOwner?
The BuildOwner for this context. The BuildOwner is in charge of managing the rendering pipeline for this context.
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
sm bool

Available on BuildContext, provided by the ElResponsiveExt extension

当前是否处于移动端布局(<=640)
no setter
value → T
The current value exposed by InheritedProvider.
no setter
widget Widget
The current configuration of the Element that is this BuildContext.
no setterinherited
xl bool

Available on BuildContext, provided by the ElResponsiveExt extension

当前是否处于超大桌面布局(<=2560)
no setter
xs bool

Available on BuildContext, provided by the ElResponsiveExt extension

当前是否处于极小布局(<=320)
no setter

Methods

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
dispatchNotification(Notification notification) → void
Start bubbling this notification at the given build context.
inherited
elBorder({Color? color, double? width}) Border

Available on BuildContext, provided by the ElBuildContextExt extension

构建默认颜色的边框对象
elPrimaryBorder({Color? color, double? width}) Border

Available on BuildContext, provided by the ElBuildContextExt extension

构建主题颜色的边框对象
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
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
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
markNeedsNotifyDependents() → void
Marks the InheritedProvider as needing to update dependents.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<T>() → T

Available on BuildContext, provided by the ReadContext extension

Obtain a value from the nearest ancestor provider of type T.
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.
toString() String
A string representation of this object.
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
Walks the children of this widget.
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
The equality operator.
inherited