FSwitchStyle.inherit constructor

FSwitchStyle.inherit({
  1. required FColors colors,
  2. required FStyle style,
})

Creates a FSwitchStyle that inherits its properties.

Implementation

factory FSwitchStyle.inherit({required FColors colors, required FStyle style}) {
  final labels = FLabelStyles.inherit(style: style);
  return .new(
    focusColor: colors.primary,
    trackColor: FVariants(
      colors.secondary,
      variants: {
        [.disabled]: colors.disable(colors.secondary),
        //
        [.selected]: colors.primary,
        [.selected.and(.disabled)]: colors.disable(colors.primary),
      },
    ),
    thumbColor: .all(colors.brightness == .light ? colors.background : colors.foreground),
    leadingLabelStyle: labels.horizontalLeadingStyle,
    trailingLabelStyle: labels.horizontalTrailingStyle,
  );
}