Skip to content

Commit e911357

Browse files
Merge pull request #8 from CyMathew/main
feat: add placeholder, placeholderStyle to FormBuilderCupertinoTextField
2 parents bc55b2c + f3e1bb0 commit e911357

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/src/fields/form_builder_cupertino_text_field.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,26 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
6363
/// {@macro flutter.services.textInput.enableSuggestions}
6464
final bool enableSuggestions;
6565

66+
/// A lighter colored placeholder hint that appears on the first line of the
67+
/// text field when the text entry is empty.
68+
///
69+
/// Defaults to having no placeholder text.
70+
///
71+
/// The text style of the placeholder text matches that of the text field's
72+
/// main text entry except a lighter font weight and a grey font color.
73+
final String? placeholder;
74+
75+
/// The style to use for the placeholder text.
76+
///
77+
/// The [placeholderStyle] is merged with the [style] [TextStyle] when applied
78+
/// to the [placeholder] text. To avoid merging with [style], specify
79+
/// [TextStyle.inherit] as false.
80+
///
81+
/// Defaults to the [style] property with w300 font weight and grey color.
82+
///
83+
/// If specifically set to null, placeholder's style will be the same as [style].
84+
final TextStyle? placeholderStyle;
85+
6686
/// {@macro flutter.widgets.editableText.maxLines}
6787
final int? maxLines;
6888

@@ -342,6 +362,8 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
342362
this.scribbleEnabled = true,
343363
this.clearButtonMode = OverlayVisibilityMode.never,
344364
this.contentInsertionConfiguration,
365+
this.placeholder,
366+
this.placeholderStyle
345367
}) : assert(maxLines == null || maxLines > 0),
346368
assert(minLines == null || minLines > 0),
347369
assert(
@@ -386,6 +408,8 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
386408
obscureText: obscureText,
387409
autocorrect: autocorrect,
388410
enableSuggestions: enableSuggestions,
411+
placeholder: placeholder,
412+
placeholderStyle: placeholderStyle,
389413
maxLengthEnforcement: maxLengthEnforcement,
390414
maxLines: maxLines,
391415
minLines: minLines,

0 commit comments

Comments
 (0)