Widget
Fields
The constants property is used to prevent reconciliation (rebuilding) when updating the widget tree. If the array of constants in the current widget matches the array in the previous widget during a reconciliation check, the system assumes the widgets are equivalent, and no further updates are applied.
The exact same widget with the same reference is always considered equivalent and therefore treated as constant, using a constants array here is not beneficial.
If the constants provided in two widgets do not match, the reconciliation system performs a normal rebuild of the corresponding widget subtree.
The key property is used to determine whether a widget can be reused or must be replaced during the reconciliation process. Keys also play a critical role in preserving widget states when the widget tree is updated.
If two widgets with the same parent have keys that are equal, those widgets are considered positionally equivalent and their states can be reused if their types match and reconciliation checks are successful.
If no key is specified, parent widgets will attempt to match children based primarily on their actual position. Insertions and removal in the middle of the widget list may lead to unintended rebuilds and state recreation as possibly valid widgets are being discarded.
Keys may also be used to for clarity or persistent tracking of a widget's identity using a GlobalKey which is guaranteed to be unique across multiple parents and holds a reference to the underlying IWidgetElement
Key
Modifiers may be added to a widget using the Widget.modifiers constructor parameter, the Widget.AddModifier or Widget.AddModifiers methods, or by using the ModifierExtensions.
Constructors
Methods
Parameters
Modifier Set - The default modifiers specified by the widget implementation.IReadOnlyCollection <Modifier> - The modifiers specified by the user.Parameters
I Widget Element - The newly created uninitialized element that is not yet attached to a panel.Operators
Inherited Members
Extension Methods
To Diagnostics Node SafeIfClipConstDisplayExpandFillFlexibleMarginOpacityPaddingPositionedShrinkSizeStretchTight StretchTightVisibilityWith ModifierTo BuildableTo FactoryDescribe IdentityShort HashTo String Nullable