API: FormBuilder DSL
The FormBuilder class provides a fluent API for constructing Form instances. Import from package:vyuh_feature_forms/dsl/form_builder.dart.
FormBuilder
Class Signature
Methods
descriptionFormBuilder description(String text)Set the form description.
hSpacingFormBuilder hSpacing(double value)Set horizontal grid spacing.
vSpacingFormBuilder vSpacing(double value)Set vertical grid spacing.
textTextFieldBuilder text(String name, {required String title})Add a text field. Auto-finalizes the previous field builder.
numberNumberFieldBuilder number(String name, {required String title})Add a number field. Auto-finalizes the previous field builder.
selectSelectFieldBuilder select(String name, {required String title})Add a select field. Auto-finalizes the previous field builder.
booleanBooleanFieldBuilder boolean(String name, {required String title})Add a boolean field. Auto-finalizes the previous field builder.
dateTimeDateTimeFieldBuilder dateTime(String name, {required String title})Add a date/time field. Auto-finalizes the previous field builder.
sliderSliderFieldBuilder slider(String name, {required String title, required double min, required double max, required int divisions})Add a slider field. Auto-finalizes the previous field builder.
phonePhoneFieldBuilder phone(String name, {required String title})Add a phone field. Auto-finalizes the previous field builder.
fileFileFieldBuilder file(String name, {required String title})Add a file picker field. Auto-finalizes the previous field builder.
imageImageFieldBuilder image(String name, {required String title})Add an image picker field. Auto-finalizes the previous field builder.
formulaFormulaFieldBuilder formula(String name, {required String title, required String expression})Add a formula field. Auto-finalizes the previous field builder.
referenceReferenceFieldBuilder reference(String name, {required String title})Add a reference field. Auto-finalizes the previous field builder.
sectionFormBuilder section(String title, void Function(FormBuilder) configure, {String? description, bool collapsible = false, bool initiallyCollapsed = false, List<FormFieldRule>? rules})Add a visual section that groups its configured fields.
buildForm build({Map<String, dynamic>? initialValues})Finalize the builder and produce a Form instance.
Each field-creation method auto-finalizes the previous field builder and returns a new one.
FieldBuilder
abstractClass Signature
Abstract base class for all field builders. TSelf is the concrete builder type for fluent chaining. Every field builder also exposes all FormBuilder field-creation methods (.text(), .number(), .select(), etc.), .section(), and .build(). Calling any of these auto-finalizes the current field and delegates to the parent FormBuilder.
TextFieldBuilder
Class Signature
NumberFieldBuilder
Class Signature
SelectFieldBuilder
Class Signature
BooleanFieldBuilder
Class Signature
DateTimeFieldBuilder
Class Signature
SliderFieldBuilder
No additional methods beyond the base. Min, max, and divisions are set in the constructor:
.slider('rating', title: 'Rating', min: 1, max: 5, divisions: 4)PhoneFieldBuilder
No additional methods beyond the base.
FileFieldBuilder
Class Signature
ImageFieldBuilder
Class Signature
FormulaFieldBuilder
Class Signature
Expression is set in the constructor.
ReferenceFieldBuilder
Class Signature
When
Class Signature
Fluent builder for creating FormFieldRule instances.