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,
  ).resolve({FButtonVariant.ghost}).resolve({FButtonSizeVariant.sm});

  final iconStyle = FVariants<FTextFieldVariantConstraint, FTextFieldVariant, IconThemeData, IconThemeDataDelta>.from(
    IconThemeData(color: colors.mutedForeground, size: 16),
    variants: {
      [.disabled]: .delta(color: colors.disable(colors.mutedForeground)),
    },
  );

  return .new(
    decoration: FVariants(
      BoxDecoration(
        border: .all(color: colors.border, width: style.borderWidth),
        borderRadius: style.borderRadius,
        color: colors.card,
      ),
      variants: {
        [.focused]: BoxDecoration(
          border: .all(color: colors.primary, width: style.borderWidth),
          borderRadius: style.borderRadius,
          color: colors.card,
        ),
        //
        [.disabled]: BoxDecoration(
          border: .all(color: colors.disable(colors.border), width: style.borderWidth),
          borderRadius: style.borderRadius,
          color: colors.card,
        ),
        //
        [.error]: BoxDecoration(
          border: .all(color: colors.error, width: style.borderWidth),
          borderRadius: style.borderRadius,
          color: colors.card,
        ),
        [.error.and(.disabled)]: BoxDecoration(
          border: .all(color: colors.disable(colors.error), width: style.borderWidth),
          borderRadius: style.borderRadius,
          color: colors.disable(colors.card),
        ),
      },
    ),
    hintTextStyle: FVariants.from(
      typography.sm.copyWith(color: colors.mutedForeground),
      variants: {
        [.disabled]: .delta(color: colors.disable(colors.mutedForeground)),
      },
    ),
    iconStyle: iconStyle,
    clearButtonStyle: ghost.copyWith(iconContentStyle: .delta(iconStyle: iconStyle.cast())),
    tappableStyle: style.tappableStyle.copyWith(motion: FTappableMotion.none),
    labelTextStyle: style.formFieldStyle.labelTextStyle,
    descriptionTextStyle: style.formFieldStyle.descriptionTextStyle,
    errorTextStyle: style.formFieldStyle.errorTextStyle,
    labelPadding: label.labelPadding,
    descriptionPadding: label.descriptionPadding,
    errorPadding: label.errorPadding,
    childPadding: label.childPadding,
  );
}