FMultiSelectFieldStyle.inherit constructor

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

Creates a FMultiSelectFieldStyle that inherits its properties.

Implementation

factory FMultiSelectFieldStyle.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
}) {
  final label = FLabelStyles.inherit(style: style).verticalStyle;
  final ghost = FButtonStyles.inherit(colors: colors, typography: typography, style: style).ghost;

  return FMultiSelectFieldStyle(
    decoration: FWidgetStateMap({
      WidgetState.error: BoxDecoration(
        border: Border.all(color: colors.error, width: style.borderWidth),
        borderRadius: style.borderRadius,
      ),
      WidgetState.disabled: BoxDecoration(
        border: Border.all(color: colors.disable(colors.border), width: style.borderWidth),
        borderRadius: style.borderRadius,
      ),
      WidgetState.focused: BoxDecoration(
        border: Border.all(color: colors.primary, width: style.borderWidth),
        borderRadius: style.borderRadius,
      ),
      WidgetState.any: BoxDecoration(
        border: Border.all(color: colors.border, width: style.borderWidth),
        borderRadius: style.borderRadius,
      ),
    }),
    hintTextStyle: FWidgetStateMap({
      WidgetState.disabled: typography.sm.copyWith(color: colors.disable(colors.border)),
      WidgetState.any: typography.sm.copyWith(color: colors.mutedForeground),
    }),
    iconStyle: IconThemeData(color: colors.mutedForeground, size: 18),
    clearButtonStyle: ghost.copyWith(
      iconContentStyle: ghost.iconContentStyle.copyWith(
        iconStyle: FWidgetStateMap({
          WidgetState.disabled: IconThemeData(color: colors.disable(colors.mutedForeground), size: 17),
          WidgetState.any: IconThemeData(color: colors.mutedForeground, size: 17),
        }),
      ),
    ),
    tappableStyle: style.tappableStyle.copyWith(bounceTween: FTappableStyle.noBounceTween),
    labelTextStyle: style.formFieldStyle.labelTextStyle,
    descriptionTextStyle: style.formFieldStyle.descriptionTextStyle,
    errorTextStyle: style.formFieldStyle.errorTextStyle,
    labelPadding: label.labelPadding,
    descriptionPadding: label.descriptionPadding,
    errorPadding: label.errorPadding,
    childPadding: label.childPadding,
  );
}