I’m having a readonly TextFormField widget like this:
TextFormField(
/// field must neither be focusable, nor must value be editable by input
canRequestFocus: false,
readOnly: true,
controller: _textEditingController,
keyboardType: TextInputType.none,
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 20,
letterSpacing: 1,
fontFamily: 'Arial',
),
minLines: 1,
maxLines: 1,
validator: null,
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(
vertical: 15.0,
horizontal: 15.0,
),
errorStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 20,
letterSpacing: 1,
fontFamily: 'Arial',
color: Colors.red,
),
errorMaxLines: 3,
labelText: 'test dskjhfkjshf kdjdfhkjshf ksdjfhkjshf ksjdhfkjshdf kjhfkjshkf skjdfhkjsdjhf kjdhfkhsf',
labelStyle: MaterialStateTextStyle.resolveWith(
(Set<MaterialState> states) =>
TextStyle(
fontWeight: FontWeight.w400,
fontSize: 20,
letterSpacing: 1,
fontFamily: 'Arial',
),
),
floatingLabelStyle: MaterialStateTextStyle.resolveWith(
(Set<MaterialState> states) {
return TextStyle(
fontWeight: FontWeight.w400,
fontSize: 20,
letterSpacing: 1,
fontFamily: 'Arial',
);
},
),
counterText: '',
),
)
I’ve tried to set the overflow: TextOverflow.visible of the floatingLabelStyle and the labelStyle properties, but this does not do anything, the example keeps overflowing in an ellipsis.
There is exactly the same issue discussed with regards to the error message overflowing, where the only way is to set the errorMaxLines of the InputDecoration to an integer bigger than 1. But there is no floatingLabelMaxLines or such, so I’m wondering if it’s even possible?
I’m trying this on the iPhone 15 Simulator on a MacBook Pro, iOS 17.




