FSelectGroupStyle.inherit constructor

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

Creates a FSelectGroupStyle that inherits its properties.

Implementation

factory FSelectGroupStyle.inherit({required FColors colors, required FTypography typography, required FStyle style}) {
  final vertical = FLabelStyles.inherit(style: style).verticalStyle;

  final labelTextStyle = FWidgetStateMap({
    WidgetState.disabled: typography.sm.copyWith(color: colors.disable(colors.primary), fontWeight: FontWeight.w500),
    WidgetState.any: typography.sm.copyWith(color: colors.primary, fontWeight: FontWeight.w500),
  });
  final descriptionTextStyle = FWidgetStateMap({
    WidgetState.disabled: typography.sm.copyWith(color: colors.disable(colors.mutedForeground)),
    WidgetState.any: typography.sm.copyWith(color: colors.mutedForeground),
  });
  final errorTextStyle = typography.sm.copyWith(color: colors.error, fontWeight: FontWeight.w500);

  return FSelectGroupStyle(
    checkboxStyle: FCheckboxStyle.inherit(colors: colors, style: style).copyWith(
      labelTextStyle: labelTextStyle,
      descriptionTextStyle: descriptionTextStyle,
      errorTextStyle: errorTextStyle,
    ),
    radioStyle: FRadioStyle.inherit(colors: colors, style: style).copyWith(
      labelTextStyle: labelTextStyle,
      descriptionTextStyle: descriptionTextStyle,
      errorTextStyle: errorTextStyle,
    ),
    labelTextStyle: style.formFieldStyle.labelTextStyle,
    descriptionTextStyle: style.formFieldStyle.descriptionTextStyle,
    errorTextStyle: style.formFieldStyle.errorTextStyle,
    labelPadding: vertical.labelPadding,
    descriptionPadding: vertical.descriptionPadding,
    errorPadding: vertical.errorPadding,
    childPadding: vertical.childPadding,
  );
}