widget method

Widget widget(
  1. Color? activeColor,
  2. Color? inactiveColor,
  3. ValueChanged<bool> onChanged,
  4. bool value,
)

Implementation

Widget widget(
  Color? activeColor,
  Color? inactiveColor,
  ValueChanged<bool> onChanged,
  bool value,
) {
  switch (this) {
    case SwitchType.material:
      return Switch(
        value: value,
        onChanged: onChanged,
        activeColor: activeColor,
        activeTrackColor: activeColor?.withOpacity(0.5),
      );
    case SwitchType.cupertino:
      return CupertinoSwitch(
        value: value,
        onChanged: onChanged,
        activeColor: activeColor,
      );
    default:
      return CustomSwitch(
        value: value,
        onChanged: onChanged,
        activeColor: activeColor,
        inactiveColor: inactiveColor,
      );
  }
}