@@ -122,43 +122,51 @@ class MaterialTextField extends StatelessWidget {
122122 /// The vertical alignment of text within an input box.
123123 final TextAlignVertical ? textAlignVertical;
124124
125- const MaterialTextField ({
126- Key ? key,
127- this .textAlign = TextAlign .start,
128- this .textAlignVertical,
129- this .keyboardType,
130- this .controller,
131- this .validator,
132- this .textInputAction,
133- this .suffixIcon,
134- this .prefixIcon,
135- this .hint,
136- this .obscureText = false ,
137- this .enabled = true ,
138- this .onChanged,
139- this .style,
140- this .icon,
141- this .iconColor,
142- this .errorStyle,
143- this .errorMaxLines,
144- this .errorText,
145- this .floatingLabelAlignment,
146- this .floatingLabelBehavior,
147- this .helperMaxLines,
148- this .helperStyle,
149- this .helperText,
150- this .hintMaxLines,
151- this .hintTextDirection,
152- this .suffixIconColor,
153- this .prefixIconColor,
154- this .prefixStyle,
155- this .prefixText,
156- this .suffixStyle,
157- this .suffixText,
158- this .labelText,
159- this .theme,
160- this .maxLength,
161- }) : super (key: key);
125+ /// Max lines for the text field
126+ int ? maxLines = 1 ;
127+
128+ /// Min lines for the text field
129+ final int ? minLines;
130+
131+ MaterialTextField (
132+ {Key ? key,
133+ this .textAlign = TextAlign .start,
134+ this .textAlignVertical,
135+ this .keyboardType,
136+ this .controller,
137+ this .validator,
138+ this .textInputAction,
139+ this .suffixIcon,
140+ this .prefixIcon,
141+ this .hint,
142+ this .obscureText = false ,
143+ this .enabled = true ,
144+ this .onChanged,
145+ this .style,
146+ this .icon,
147+ this .iconColor,
148+ this .errorStyle,
149+ this .errorMaxLines,
150+ this .errorText,
151+ this .floatingLabelAlignment,
152+ this .floatingLabelBehavior,
153+ this .helperMaxLines,
154+ this .helperStyle,
155+ this .helperText,
156+ this .hintMaxLines,
157+ this .hintTextDirection,
158+ this .suffixIconColor,
159+ this .prefixIconColor,
160+ this .prefixStyle,
161+ this .prefixText,
162+ this .suffixStyle,
163+ this .suffixText,
164+ this .labelText,
165+ this .theme,
166+ this .maxLength,
167+ this .maxLines,
168+ this .minLines})
169+ : super (key: key);
162170
163171 @override
164172 Widget build (BuildContext context) {
@@ -207,6 +215,8 @@ class MaterialTextField extends StatelessWidget {
207215 style: style,
208216 textInputAction: textInputAction,
209217 maxLength: maxLength,
218+ maxLines: obscureText ? 1 : maxLines,
219+ minLines: minLines,
210220 );
211221 }
212222}
0 commit comments