FFormFieldStyle.inherit constructor

FFormFieldStyle.inherit({
  1. required FColors colors,
  2. required FTypography typography,
  3. required bool touch,
})

Creates a FFormFieldStyle that inherits its properties.

Implementation

factory FFormFieldStyle.inherit({required FColors colors, required FTypography typography, required bool touch}) {
  final textStyle = touch ? typography.xs : typography.sm;
  return FFormFieldStyle(
    labelTextStyle: FVariants.from(
      textStyle.copyWith(color: colors.foreground, fontWeight: .w500),
      variants: {
        [.error]: .delta(color: colors.error),
        [.disabled]: .delta(color: colors.disable(colors.foreground)),
        [.disabled.and(.error)]: .delta(color: colors.disable(colors.error)),
      },
    ),
    descriptionTextStyle: FVariants.from(
      textStyle.copyWith(color: colors.mutedForeground),
      variants: {
        [.disabled]: .delta(color: colors.disable(colors.mutedForeground)),
      },
    ),
    errorTextStyle: FVariants.from(
      textStyle.copyWith(color: colors.error),
      variants: {
        [.disabled]: .delta(color: colors.disable(colors.error)),
      },
    ),
  );
}