在Flutter中,当输入的文本长度超过字段长度时,文本将隐藏,如gif中所示:
第一个文字表单字段的程式码:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
labelFormStyle("Nome do equipamento"),
Container(
height: hasErrorForm && equipmentNameController.text.isEmpty ? 55 : 35,
child: Container(
height: hasErrorForm && equipmentNameController.text.isEmpty ? 55 : 35,
child: TextFormField(
validator: (value){
return validatorEmpty(value);
},
controller: equipmentNameController,
keyboardType: TextInputType.multiline,
maxLines: null,
textInputAction: TextInputAction.next,
style: TextStyle(
fontSize: 14
),
decoration: InputDecoration(
isDense: true,
enabledBorder: enableBorderField(),
focusedBorder: enableBorderField(),
disabledBorder: enableBorderField(),
border: enableBorderField(),
focusedErrorBorder: errorBorderField(equipmentNameController.text.isEmpty),
errorBorder: errorBorderField(equipmentNameController.text.isEmpty)
),
onChanged: (value){
if(hasErrorForm){
setState(() {
_formKey.currentState!.validate();
});
}
},
),
),
],
),
这怎么解决?
1条答案
按热度按时间k2arahey1#
我设法通过删除高度限制并将maxLines:1.唯一的问题是它没有达到设计师想要的尺寸,但我会和他谈谈这件事