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 label = FLabelStyles.inherit(style: style).horizontalStyle;
  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),
    labelTextStyle: style.formFieldStyle.labelTextStyle,
    descriptionTextStyle: style.formFieldStyle.descriptionTextStyle,
    errorTextStyle: style.formFieldStyle.errorTextStyle,
    labelPadding: label.labelPadding,
    descriptionPadding: label.descriptionPadding,
    errorPadding: label.errorPadding,
    childPadding: label.childPadding,
  );
}