DynamicField class
Configuration for an individual form field.
Constructors
-
DynamicField({required String key, required FieldType type, String? label, String? hint, Map<
String, dynamic> ? validation, String? validator(dynamic)?, dynamic initialValue, bool enabled = true, bool obscured = false, bool readOnly = false, void onChanged(dynamic)?, Iterable<String> ? autofillHints, List<DynamicField> ? fields, List<DropdownOption> ? options, Conditional? conditional, Map<String, dynamic> ? visibleIf, Map<String, dynamic> ? extra, Map<String, dynamic> ? customData, FieldDecorationOverride? decorationOverride, InputDecoration? decoration, TextStyle? style, Widget? prefix, Widget? suffix, Color? activeColor, Color? activeThumbColor, Color? checkColor, Color? inactiveTrackColor, Color? inactiveThumbColor}) -
Creates a new DynamicField instance.
const
-
DynamicField.fromJson(Map<
String, dynamic> json) -
Creates a DynamicField instance from a JSON map.
factory
Properties
- activeColor → Color?
-
The color to use when the checkbox or switch is active.
final
- activeThumbColor → Color?
-
The color of the thumb when the switch is active.
final
-
autofillHints
→ Iterable<
String> ? -
Autofill hints for the field.
final
- checkColor → Color?
-
The color of the checkmark in a checkbox.
final
- conditional → Conditional?
-
Defines conditional visibility logic for this field.
final
-
customData
→ Map<
String, dynamic> ? -
Custom data to pass extra parameters without modifying core logic.
final
- decoration → InputDecoration?
-
Custom input decoration to override the default theme or decorationProps.
final
- decorationOverride → FieldDecorationOverride?
-
Custom properties to override the
InputDecorationfor this specific field.final - enabled → bool
-
Whether the field is enabled for user interaction.
final
-
extra
→ Map<
String, dynamic> ? -
Extra custom data associated with the field.
final
-
fields
→ List<
DynamicField> ? -
Nested fields, used when type is FieldType.group.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hint → String?
-
The hint text displayed when the field is empty.
final
- inactiveThumbColor → Color?
-
The color of the thumb when the switch is inactive.
final
- inactiveTrackColor → Color?
-
The color of the track when the switch is inactive.
final
- initialValue → dynamic
-
Initial value for the field.
final
- key → String
-
Unique identifier for the field, used as the key in the form data map.
final
- label → String?
-
The label displayed for the field.
final
- obscured → bool
-
Whether the input text should be obscured (e.g., for password fields).
final
- onChanged → void Function(dynamic)?
-
Callback when the field value changes.
final
-
options
→ List<
DropdownOption> ? -
List of options for fields that require selection (like dropdown).
final
- prefix → Widget?
-
Custom widget to display at the beginning of the field.
final
- readOnly → bool
-
Whether the field is read-only.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → TextStyle?
-
Custom text style for the field input text.
final
- suffix → Widget?
-
Custom widget to display at the end of the field.
final
- type → FieldType
-
The type of the field (e.g., text, dropdown, checkbox).
final
-
validation
→ Map<
String, dynamic> ? -
Validation rules for the field (e.g., {'required': true, 'minLength': 5}).
final
- validator → String? Function(dynamic)?
-
Custom validation callback, similar to TextFormField's validator.
final
-
visibleIf
→ Map<
String, dynamic> ? -
A simpler way to define conditional visibility based on key-value pairs.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this DynamicField instance to a JSON map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited