FTextFieldStyle.inherit constructor
FTextFieldStyle.inherit({
- required FColors colors,
- required FTypography typography,
- required FStyle style,
Creates a FTextFieldStyle that inherits its properties.
Implementation
factory FTextFieldStyle.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;
final textStyle = typography.sm.copyWith(fontFamily: typography.defaultFontFamily);
return FTextFieldStyle(
keyboardAppearance: colors.brightness,
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),
}),
),
),
contentTextStyle: FWidgetStateMap({
WidgetState.disabled: textStyle.copyWith(color: colors.disable(colors.primary)),
WidgetState.any: textStyle.copyWith(color: colors.primary),
}),
hintTextStyle: FWidgetStateMap({
WidgetState.disabled: textStyle.copyWith(color: colors.disable(colors.border)),
WidgetState.any: textStyle.copyWith(color: colors.mutedForeground),
}),
counterTextStyle: FWidgetStateMap({
WidgetState.disabled: textStyle.copyWith(color: colors.disable(colors.primary)),
WidgetState.any: textStyle.copyWith(color: colors.primary),
}),
border: FWidgetStateMap({
WidgetState.error: OutlineInputBorder(
borderSide: BorderSide(color: colors.error, width: style.borderWidth),
borderRadius: style.borderRadius,
),
WidgetState.disabled: OutlineInputBorder(
borderSide: BorderSide(color: colors.disable(colors.border), width: style.borderWidth),
borderRadius: style.borderRadius,
),
WidgetState.focused: OutlineInputBorder(
borderSide: BorderSide(color: colors.primary, width: style.borderWidth),
borderRadius: style.borderRadius,
),
WidgetState.any: OutlineInputBorder(
borderSide: BorderSide(color: colors.border, width: style.borderWidth),
borderRadius: style.borderRadius,
),
}),
labelTextStyle: style.formFieldStyle.labelTextStyle,
descriptionTextStyle: style.formFieldStyle.descriptionTextStyle,
errorTextStyle: style.formFieldStyle.errorTextStyle,
labelPadding: label.labelPadding,
descriptionPadding: label.descriptionPadding,
errorPadding: label.errorPadding,
childPadding: label.childPadding,
);
}