I am working on a Flutter project, I have implemented a Form with a TextFormField, we have some fields with really long labels, and because they are so long, Flutter us cutting the text off and adding ... in the end, is it possible to set the overflow so it makes the label text in to 2 lines instead of cutting the text off?
TextFormField(
key: GlobalKey(),
controller: _textEditingController,
focusNode: _focusNode,
obscureText: true,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.done,
decoration: widget.decorations.copyWith(
errorText:
widget.field["error"] != null ? widget.field["error"] : null,
labelText: "A VERY VERY VERY VERY VERY VERY LONG LABEL",
hintText: widget.field["helpText"],
helperStyle: TextStyle(
color: Colors.black,
),
),
onFieldSubmitted: widget.onFieldSubmitted,
onSaved: widget.onSaved,
onTap: widget.onTap,
),
I found this solution while I was trying to solve the same problem. Try using the decoration property with the errorMaxLines property set to a number greater than 1.
E.g.
TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
errorMaxLines: 2,),)
It works for me....
TextFormField(
decoration: InputDecoration(
label: Text(
"A VERY VERY VERY VERY VERY VERY LONG LABEL",
),)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With