【发布时间】:2022-01-19 12:51:20
【问题描述】:
除了元素/用户输入和底栏之间的空间外,一切正常。我尝试了不同的方法来摆脱那个空间:内容填充、框约束、前缀图标约束等。没有一个工作。最终我限制了这个小部件的高度,但随后我的错误消息被放置在用户输入之上,我收到了这条消息Another exception was thrown: BoxConstraints has a negative minimum height.
代码如下:
Widget _emailField(FormBloc formBloc) {
return StreamBuilder(
stream: formBloc.email,
builder: (context, AsyncSnapshot<String> snapshot) {
return TextFormField(
autofocus: false,
keyboardType: TextInputType.emailAddress,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value) {
if (value == null) {
return "Email cannot be empty";
} else {
if (value.isEmpty) {
return "Email cannot be empty";
}
}
},
onChanged: formBloc.changeEmail,
textInputAction: TextInputAction.next,
decoration: InputDecoration(
prefixIcon: const Icon(
Icons.email,
size: 15,
),
contentPadding: const EdgeInsets.all(0),
labelText: "Email",
labelStyle: const TextStyle(fontSize: 14),
errorText:
snapshot.error != null ? snapshot.error as String : null,
),
);
}
);
}
我需要让一切都像以前一样工作,除了这次我确实需要在底部边框和输入元素之间没有空间,我该怎么做?
【问题讨论】:
标签: flutter textfield textinput textformfield