FormFieldControl
Base class for Material form-field controls with a decorated input area.
It provides the shared label, hint, helper, error, prefix, suffix, fill, and
border properties used by controls such as TextField and
DropdownM2.
Inherits: LayoutControl
Properties
align_label_with_hint- Whether the floating label should align withhint_text.bgcolor- TextField background color.border- The border drawn around the decorated input area.border_colordeprecated - The border color.border_radiusdeprecated - Rounds the corners of an outlined border.border_widthdeprecated - The width of the border in virtual pixels.collapsed- Whether the decoration should be the same size as the input field.color- Text color.content_padding- The padding for the input decoration's container.counter- AControlto place below the line as a character count.counter_style- The text style to use forcounter.dense- Whether this control is part of a dense form (ie, uses less vertical space).error- Text that appears below the input border.error_max_lines- The maximum number of lines theerrorcan occupy.error_style- The text style to use forerror.fill_color- Background color of TextField.filled- Whether the decoration's container is filled withfill_color.fit_parent_size- Whether the editable area should expand to fill the height of its parent.focus_color- The fill color of the decoration's container when the control has input focus.focused_bgcolor- Background color in focused state.focused_border_colordeprecated - Border color in focused state.focused_border_widthdeprecated - Border width in focused state.focused_color- The text's color when focused.helper- Text that provides context about the input's value, such as how the value will be used.helper_max_lines- The maximum number of lines thehelpercan occupy.helper_style- The text style to use forhelper.hint_fade_duration- The duration of thehint_textfade-in and fade-out animations.hint_max_lines- The maximum number of lines thehint_textcan occupy.hint_style- The text style to use forhint_text.hint_text- Text that suggests what sort of input the field accepts.hover_color- Background color of TextField when hovered.icon- The icon to show before the input field and outside of the decoration's container.label- Optional text that describes the input field.label_style- The text style to use forlabel.prefix- AControlto place on the line before the input.prefix_icon- An icon that appears before the editable part of the text field, within the decoration's container.prefix_icon_size_constraints- Size constraints for the area surroundingprefix_icon.prefix_style- The text style to use forprefix.size_constraints- Defines the minimum and maximum size of the input decorator.suffix- AControlto place on the line after the input.suffix_icon- An icon that appears after the editable part of the text field and after thesuffix, within the decoration's container.suffix_icon_size_constraints- Size constraints for the area surroundingsuffix_icon.suffix_style- The text style to use forsuffix.text_size- Text size in virtual pixels.text_style- TheTextStyleto use for the text being edited.text_vertical_align- Defines how the text should be aligned vertically.
Methods
Properties
align_label_with_hintclass-attributeinstance-attribute
align_label_with_hint: bool | None = NoneWhether the floating label should align with hint_text.
This is typically set to True for multiline text input to align the label with
the top of the hint instead of centering it vertically.
bgcolorclass-attributeinstance-attribute
bgcolor: ColorValue | None = NoneTextField background color.
Will not be visible if filled is False.
borderclass-attributeinstance-attribute
border: ControlStateValue[InputBorder] | None = NoneThe border drawn around the decorated input area.
Accepts a single InputBorder or a dictionary mapping
ControlStates to InputBorders. Supported
state keys are ControlState.DEFAULT,
ControlState.FOCUSED, ControlState.ERROR,
and ControlState.DISABLED.
A single border defines the shape for all states. If its side is unset,
the Material theme resolves the border color and weight per state (for
example, the focused border uses the theme's primary color); an explicit
side applies to the enabled state while the other states remain
theme-resolved.
In the dictionary form, the DEFAULT entry behaves like the single form,
and each state entry without an explicit side falls back to the DEFAULT
entry's side, if set.
border_colorclass-attributedeprecatedinstance-attribute
border_color: ColorValue | None = NoneDeprecated since version 1.0.0 and scheduled for removal in 1.3.0. Use border with a BorderSide instead.
The border color.
border_radiusclass-attributedeprecatedinstance-attribute
border_radius: BorderRadiusValue | None = NoneDeprecated since version 1.0.0 and scheduled for removal in 1.3.0. Use border with an OutlineInputBorder instead.
Rounds the corners of an outlined border.
border_widthclass-attributedeprecatedinstance-attribute
border_width: Number | None = NoneDeprecated since version 1.0.0 and scheduled for removal in 1.3.0. Use border with a BorderSide instead.
The width of the border in virtual pixels.
collapsedclass-attributeinstance-attribute
collapsed: bool | None = NoneWhether the decoration should be the same size as the input field.
A collapsed decoration removes the extra padding normally added by the decorator.
content_paddingclass-attributeinstance-attribute
content_padding: PaddingValue | None = NoneThe padding for the input decoration's container.
counterclass-attributeinstance-attribute
counter: StrOrControl | None = NoneA Control to place below the line as a character count.
If None or an empty string then nothing will appear in the counter's location.
counter_styleclass-attributeinstance-attribute
counter_style: TextStyle | None = NoneThe text style to use for counter.
denseclass-attributeinstance-attribute
dense: bool | None = NoneWhether this control is part of a dense form (ie, uses less vertical space).
errorclass-attributeinstance-attribute
error: StrOrControl | None = NoneText that appears below the input border.
If non-null, the border's color animates to red
and the helper is not shown.