FormattedInput constructor
const
FormattedInput({
- Key? key,
- FormattedValue? initialValue,
- ValueChanged<
FormattedValue> ? onChanged, - TextStyle? style,
- Widget? leading,
- Widget? trailing,
- bool enabled = true,
- FormattedInputController? controller,
Creates a FormattedInput.
The input structure is defined by the initialValue or controller
value, which contains the mix of static text and editable segments.
Each editable segment can have its own length restrictions and formatting.
Parameters:
initialValue(FormattedValue?, optional): Initial structure and valuesonChanged(ValueChanged<FormattedValue>?, optional): Callback for value changesstyle(TextStyle?, optional): Text styling for all segmentsleading(Widget?, optional): Widget displayed before the inputtrailing(Widget?, optional): Widget displayed after the inputenabled(bool, default: true): Whether the input accepts user interactioncontroller(FormattedInputController?, optional): External controller for programmatic control
Example:
FormattedInput(
initialValue: FormattedValue([
FormattedValuePart.static('$'),
FormattedValuePart.editable('0.00', length: 8),
]),
leading: Icon(Icons.attach_money),
style: TextStyle(fontSize: 16),
);
Implementation
const FormattedInput({
super.key,
this.initialValue,
this.onChanged,
this.style,
this.leading,
this.trailing,
this.enabled = true,
this.controller,
});