thumbIcon property

MaterialStateProperty<Icon?>? thumbIcon
final

The icon to use on the thumb of this switch

Resolved in the following states:

This example resolves the thumbIcon based on the current MaterialState of the Switch, providing a different Icon when it is MaterialState.disabled.
link
Switch(
  value: true,
  onChanged: (bool value) { },
  thumbIcon: MaterialStateProperty.resolveWith<Icon?>((Set<MaterialState> states) {
    if (states.contains(MaterialState.disabled)) {
      return const Icon(Icons.close);
    }
    return null; // All other states will use the default thumbIcon.
  }),
)

It is overridden by Switch.thumbIcon.

Implementation

final MaterialStateProperty<Icon?>? thumbIcon;