mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Brings over the changes from `Switch.adaptive` into `CupertinoSwitch`. This change adds the following `Switch` parameters to `CupertinoSwitch`: `inactiveThumbColor,` `activeThumbImage`, `onActiveThumbImageError`, `inactiveThumbImage`, `onInactiveThumbImageError`, `trackOutlineColor`, `trackOutlineWidth`, `thumbIcon`, `mouseCursor`. The following `Switch` parameters are ignored: * `activeTrackColor`: because `activeColor` has the same function. * `inactiveTrackColor`: because `trackColor` has the same function. * `materialTapTargetSize`: because it is only applicable in `Material`. * `hoverColor`, `overlayColor`, `splashRadius`: because these parameters configure the radial reaction overlay in `Material`, so are not applicable here. The following `CupertinoSwitch` parameters which are absent from `Switch.adaptive` are retained: * `onLabelColor`, * `offLabelColor`, * `applyTheme` `trackColor` and `thumbColor` are of type `WidgetStateProperty` in Material `Switch`, but are currently of type `Color` in `CupertinoSwitch`. For backwards compatibility, both parameters are kept as `Color`s, but can be resolved in different `WidgetState`s using `WidgetStateColor.resolve()`. This PR does not apply any fidelity updates to `CupertinoSwitch`. Part of https://github.com/flutter/flutter/issues/149275 Related PRs: https://github.com/flutter/flutter/pull/130425 https://github.com/flutter/flutter/pull/148804