FSelectGroupStyle.inherit constructor

FSelectGroupStyle.inherit({
  1. required FColorScheme colorScheme,
  2. required FTypography typography,
  3. required FStyle style,
})

Creates a FSelectGroupStyle that inherits its properties from the given parameters.

Implementation

factory FSelectGroupStyle.inherit({
  required FColorScheme colorScheme,
  required FTypography typography,
  required FStyle style,
}) {
  final checkboxStyle = FCheckboxStyle.inherit(colorScheme: colorScheme, style: style);
  final checkboxSelectGroupStyle = FCheckboxSelectGroupStyle.inherit(
    style: checkboxStyle.copyWith(
      enabledStyle: checkboxStyle.enabledStyle.copyWith(
        labelTextStyle: typography.sm.copyWith(
          color: colorScheme.primary,
          fontWeight: FontWeight.w500,
        ),
        descriptionTextStyle: typography.sm.copyWith(color: colorScheme.mutedForeground),
      ),
      disabledStyle: checkboxStyle.disabledStyle.copyWith(
        labelTextStyle: typography.sm.copyWith(
          color: colorScheme.disable(colorScheme.primary),
          fontWeight: FontWeight.w500,
        ),
        descriptionTextStyle: typography.sm.copyWith(color: colorScheme.disable(colorScheme.mutedForeground)),
      ),
      errorStyle: checkboxStyle.errorStyle.copyWith(
        labelTextStyle: typography.sm.copyWith(
          color: colorScheme.primary,
          fontWeight: FontWeight.w500,
        ),
        descriptionTextStyle: typography.sm.copyWith(color: colorScheme.mutedForeground),
        errorTextStyle: typography.sm.copyWith(
          color: colorScheme.error,
          fontWeight: FontWeight.w500,
        ),
      ),
    ),
  );

  final radioStyle = FRadioStyle.inherit(colorScheme: colorScheme, style: style);
  final radioSelectGroupStyle = FRadioSelectGroupStyle.inherit(
    style: radioStyle.copyWith(
      enabledStyle: radioStyle.enabledStyle.copyWith(
        labelTextStyle: typography.sm.copyWith(
          color: colorScheme.primary,
          fontWeight: FontWeight.w500,
        ),
        descriptionTextStyle: typography.sm.copyWith(color: colorScheme.mutedForeground),
      ),
      disabledStyle: radioStyle.disabledStyle.copyWith(
        labelTextStyle: typography.sm.copyWith(
          color: colorScheme.disable(colorScheme.primary),
          fontWeight: FontWeight.w500,
        ),
        descriptionTextStyle: typography.sm.copyWith(color: colorScheme.disable(colorScheme.mutedForeground)),
      ),
      errorStyle: radioStyle.errorStyle.copyWith(
        labelTextStyle: typography.sm.copyWith(
          color: colorScheme.primary,
          fontWeight: FontWeight.w500,
        ),
        descriptionTextStyle: typography.sm.copyWith(color: colorScheme.mutedForeground),
        errorTextStyle: typography.sm.copyWith(
          color: colorScheme.error,
          fontWeight: FontWeight.w500,
        ),
      ),
    ),
  );

  return FSelectGroupStyle(
    labelLayoutStyle: FLabelStyles.inherit(style: style).verticalStyle.layout,
    enabledStyle: FSelectGroupStateStyle(
      labelTextStyle: style.enabledFormFieldStyle.labelTextStyle,
      descriptionTextStyle: style.enabledFormFieldStyle.descriptionTextStyle,
    ),
    disabledStyle: FSelectGroupStateStyle(
      labelTextStyle: style.disabledFormFieldStyle.labelTextStyle,
      descriptionTextStyle: style.disabledFormFieldStyle.descriptionTextStyle,
    ),
    errorStyle: FSelectGroupErrorStyle(
      labelTextStyle: style.errorFormFieldStyle.labelTextStyle,
      descriptionTextStyle: style.errorFormFieldStyle.descriptionTextStyle,
      errorTextStyle: style.errorFormFieldStyle.errorTextStyle,
    ),
    checkboxStyle: checkboxSelectGroupStyle,
    radioStyle: radioSelectGroupStyle,
  );
}