defaultColor static method

WidgetStateProperty<Color?>? defaultColor(
  1. Color? enabled,
  2. Color? disabled
)

Returns null if enabled and disabled are null. Otherwise, returns a WidgetStateProperty that resolves to disabled when WidgetState.disabled is active, and enabled otherwise.

A convenience method for subclasses.

Implementation

static WidgetStateProperty<Color?>? defaultColor(Color? enabled, Color? disabled) {
  if ((enabled ?? disabled) == null) {
    return null;
  }
  return WidgetStateProperty<Color?>.fromMap(
    <WidgetStatesConstraint, Color?>{
      WidgetState.disabled: disabled,
      WidgetState.any: enabled,
    },
  );
}