copyWith method

SwitchTheme copyWith({
  1. ValueGetter<Color?>? activeColor,
  2. ValueGetter<Color?>? inactiveColor,
  3. ValueGetter<Color?>? activeThumbColor,
  4. ValueGetter<Color?>? inactiveThumbColor,
  5. ValueGetter<double?>? gap,
  6. ValueGetter<BorderRadiusGeometry?>? borderRadius,
})

Returns a copy of this theme with the given fields replaced.

Implementation

SwitchTheme copyWith({
  ValueGetter<Color?>? activeColor,
  ValueGetter<Color?>? inactiveColor,
  ValueGetter<Color?>? activeThumbColor,
  ValueGetter<Color?>? inactiveThumbColor,
  ValueGetter<double?>? gap,
  ValueGetter<BorderRadiusGeometry?>? borderRadius,
}) {
  return SwitchTheme(
    activeColor: activeColor == null ? this.activeColor : activeColor(),
    inactiveColor:
        inactiveColor == null ? this.inactiveColor : inactiveColor(),
    activeThumbColor:
        activeThumbColor == null ? this.activeThumbColor : activeThumbColor(),
    inactiveThumbColor: inactiveThumbColor == null
        ? this.inactiveThumbColor
        : inactiveThumbColor(),
    gap: gap == null ? this.gap : gap(),
    borderRadius: borderRadius == null ? this.borderRadius : borderRadius(),
  );
}