TextField(
style: AppTextStyle.textStyleRegular,
controller: controller,
cursorHeight: 24,
keyboardType: TextInputType.multiline,
maxLines: numberOfLines,
minLines: numberOfLines,
decoration: InputDecoration(
errorText: 'Please provide a title',
contentPadding: const EdgeInsets.all(10.0),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 3, color: Colors.red),
),
focusedErrorBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 3, color: Colors.red),
),
disabledBorder: InputBorder.none,
),
)
For some reason the border does not accomodate the textfield completely. Changing the error string to an empty string doesn't help. I can do without the error message but the border should perfectly cover the textfield.
errorText: !_isValid ? '' : null,
//THIS WAS WHAT WAS NEEDED:
errorStyle:
const TextStyle(height: 0, color: Colors.transparent),
After this, the error text does not take any space and thus the border fits the textfield correctly.