RectGetter class
需要实时获得某个Widget的Rect信息时使用该控件 可选传GlobalKey和无参两种构造方式,之后利用对象本身或者构造传入的key以获取信息 Use this widget to get a widget`s rectangle information in real-time . It has 2 constructors , pass a globalkey or use default key , and then you can use the key or object itself to get info .
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- RectGetter
Constructors
-
RectGetter({required GlobalKey<
_RectGetterState> key, required Widget child}) - 传GlobalKey构造,之后可以RectGetter.getRectFromKey(key)的方式获得Rect constructor with key passed , and then you can get child`s rect by using RectGetter.getRectFromKey(key)
- RectGetter.defaultKey({required Widget child})
-
生成默认GlobalKey的命名无参构造,调用对象的getRect方法获得Rect
Use defaultKey to build RectGetter , and then use object itself
s getRect() method to get child
s rectfactory
Properties
Methods
-
clone(
) → RectGetter - 克隆出新对象实例,避免同一GlobalKey在组件树上重复出现导致的问题 make a clone with different GlobalKey
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _RectGetterState -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
getRect(
) → Rect? -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
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}) → 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 widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
createGlobalKey(
) → GlobalKey< _RectGetterState> - create a custom globalkey , use this way to avoid type exception in dart2 .
-
getRectFromKey(
GlobalKey< _RectGetterState> globalKey) → Rect? - 持有某RectGetter对象的key时利用该方法获得其child的rect Use this static method to get child`s rectangle information when had a custom globalkey