WidgetStatePropertyDelegate<T> typedef
WidgetStatePropertyDelegate<T> =
T Function(BuildContext context, Set<WidgetState> states, T value)
Overrides a value that has already been resolved for the current states.
Unlike WidgetStatePropertyResolver, a delegate also receives the value
the widget would otherwise have used, so it can adjust one facet and leave
the rest of the resolved value alone rather than rebuilding it from nothing.
Parameters:
context: The build context, for reading theme data.states: The states currently active on the widget.value: The value the widget resolved on its own.
Returns the final value of type T.
Example:
WidgetStatePropertyDelegate<Decoration> outline = (context, states, value) {
return (value as BoxDecoration).copyWith(
border: Border.all(
color: states.focused ? Colors.blue : Colors.gray,
),
);
};
Implementation
typedef WidgetStatePropertyDelegate<T> = T Function(
BuildContext context,
Set<WidgetState> states,
T value,
);