text method

void text({
  1. required String customId,
  2. required String title,
  3. String? placeholder,
  4. String? defaultValue,
  5. DialogFieldConstraint? constraint,
})

Implementation

void text(
    {required String customId,
    required String title,
    String? placeholder,
    String? defaultValue,
    DialogFieldConstraint? constraint}) {
  final element = DialogElementBuilder.input(customId);

  if (placeholder != null) {
    element.setPlaceholder(placeholder);
  }

  if (defaultValue != null) {
    element.setDefaultValue(defaultValue);
  }

  if (constraint != null) {
    element.setConstraint(
      maxLength: constraint.maxLength,
      minLength: constraint.minLength,
      required: constraint.required,
    );
  }

  element.setLabel(title);

  final row = RowBuilder()..addComponent(element);

  _elements.add(row);
}