WidgetSurveyor class
Class that allows callers to measure the size of arbitrary widgets when laid out with specific constraints.
The widget surveyor creates synthetic widget trees to hold the widgets it measures. This is important because if the widgets (or any widgets in their subtrees) depend on any inherited widgets (e.g. Directionality) that they assume exist in their ancestry, those assumptions may hold true when the widget is rendered by the application but prove false when the widget is rendered via the widget surveyor. Due to this, callers are advised to either:
- pass in widgets that don't depend on inherited widgets, or
- ensure all inherited widget dependencies exist in the widget tree that's passed to the widget surveyor's measure methods.
Constructors
- WidgetSurveyor()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
measureBuilder(
WidgetBuilder builder, {BoxConstraints constraints = const BoxConstraints()}) → Size - Builds a widget from the specified builder, inserts the widget into a synthetic widget tree, lays out the resulting render tree, and returns the size of the laid-out render tree.
-
measureDistanceToActualBaseline(
Widget widget, {TextBaseline baseline = TextBaseline.alphabetic, BoxConstraints constraints = const BoxConstraints()}) → double? -
measureDistanceToBaseline(
Widget widget, {TextBaseline baseline = TextBaseline.alphabetic, BoxConstraints constraints = const BoxConstraints()}) → double -
measureWidget(
Widget widget, {BoxConstraints constraints = const BoxConstraints()}) → Size - Inserts the specified widget into a synthetic widget tree, lays out the resulting render tree, and returns the size of the laid-out render tree.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited