FTextFieldSizeStyles.inherit constructor
FTextFieldSizeStyles.inherit({
- required FColors colors,
- required FTypography typography,
- required FStyle style,
- required bool touch,
Creates a FTextFieldSizeStyles that inherits its properties.
Implementation
factory inherit({
required FColors colors,
required FTypography typography,
required FStyle style,
required bool touch,
}) {
final iconStyle = FVariants<FTextFieldVariantConstraint, FTextFieldVariant, IconThemeData, IconThemeDataDelta>.from(
IconThemeData(color: colors.mutedForeground, size: typography.body.sm.fontSize),
variants: {
[.disabled]: .delta(color: colors.disable(colors.mutedForeground)),
},
);
FTextFieldStyle textField(
FButtonStyle buttonStyle,
BoxConstraints constraints,
EdgeInsetsGeometry contentPadding,
) => FTextFieldStyle.inherit(
colors: colors,
style: style,
labelStyle: FLabelStyles.inherit(style: style).verticalStyle,
textStyle: typography.body.sm,
iconStyle: iconStyle,
buttonStyle: buttonStyle,
constraints: constraints,
contentPadding: contentPadding,
);
final ghost = FButtonStyles.inherit(colors: colors, typography: typography, style: style, touch: touch).ghost;
final buttonStyle = ghost.sm.copyWith(
iconContentStyle: ghost.sm.iconContentStyle.copyWith(iconStyle: iconStyle.cast()),
);
if (touch) {
final md = textField(
buttonStyle,
const BoxConstraints(minHeight: 44),
const .symmetric(horizontal: 12, vertical: 10),
);
return FTextFieldSizeStyles(
FVariants(
md,
variants: {
[.sm]: textField(
buttonStyle,
const BoxConstraints(minHeight: 40),
const .symmetric(horizontal: 12, vertical: 8),
),
[.md]: md,
[.lg]: textField(
buttonStyle,
const BoxConstraints(minHeight: 48),
const .symmetric(horizontal: 12, vertical: 12),
),
},
),
);
} else {
final md = textField(
buttonStyle,
const BoxConstraints(minHeight: 36),
const .symmetric(horizontal: 10, vertical: 9),
);
return FTextFieldSizeStyles(
FVariants(
md,
variants: {
[.sm]: textField(
ghost.xs.copyWith(iconContentStyle: ghost.xs.iconContentStyle.copyWith(iconStyle: iconStyle.cast())),
const BoxConstraints(minHeight: 32),
const .symmetric(horizontal: 10, vertical: 7),
),
[.md]: md,
[.lg]: textField(
buttonStyle,
const BoxConstraints(minHeight: 40),
const .symmetric(horizontal: 10, vertical: 11),
),
},
),
);
}
}