FSwitchStyle.inherit constructor

FSwitchStyle.inherit({
  1. required FColorScheme colorScheme,
  2. required FStyle style,
})

Creates a FSwitchStyle that inherits its properties from colorScheme.

Implementation

FSwitchStyle.inherit({required FColorScheme colorScheme, required FStyle style})
    : focusColor = colorScheme.primary,
      labelLayoutStyle = FLabelStyles.inherit(style: style).horizontal.layout,
      enabledStyle = FSwitchStateStyle(
        checkedColor: colorScheme.primary,
        uncheckedColor: colorScheme.border,
        thumbColor: colorScheme.background,
        labelTextStyle: style.enabledFormFieldStyle.labelTextStyle,
        descriptionTextStyle: style.enabledFormFieldStyle.descriptionTextStyle,
      ),
      disabledStyle = FSwitchStateStyle(
        checkedColor: colorScheme.primary.withOpacity(0.5),
        uncheckedColor: colorScheme.border.withOpacity(0.5),
        thumbColor: colorScheme.background,
        labelTextStyle: style.disabledFormFieldStyle.labelTextStyle,
        descriptionTextStyle: style.disabledFormFieldStyle.descriptionTextStyle,
      ),
      errorStyle = FSwitchErrorStyle(
        labelTextStyle: style.errorFormFieldStyle.labelTextStyle,
        descriptionTextStyle: style.errorFormFieldStyle.descriptionTextStyle,
        errorTextStyle: style.errorFormFieldStyle.errorTextStyle,
      );