如何解决如何在flutter中删除可搜索的下拉默认填充?
您好,这是我的 flutter widget SearchableDropdown,它使用容器包装,仅用于突出显示边框以了解小部件已占用多少空间。 我想减少 SearchableDropdown 小部件在文本周围的填充/空间,并使 UI like this. 如何做到这一点?
new Column(
crossAxisAlignment: CrossAxisAlignment.start,children: [
new Text(
'You are here',style: GoogleFonts.poppins(
color: HexColor("#B8B8B8"),fontSize: 10),textAlign: TextAlign.start,),new Container(
decoration: new BoxDecoration(
border: Border.all(color: Colors.red),child: _searchableDropDown(context,providerData),)
],Widget _searchableDropDown(BuildContext context,HomePageProviderData data) {
return new SearchableDropdown.single(
hint: new Text(
data.currentCity,style: GoogleFonts.poppins(
textStyle: TextStyle(
color: Color(0xFF373539),fontSize: 16,fontWeight: FontWeight.w600),underline: SizedBox(),displayClearIcon: false,items: data.listCity.map((item) {
//
}).toList(),onChanged: (String value) {
//
},);
}
解决方法
尝试像这样将下拉列表包含在 const handleSubmit = (event,yourParam1,yourParam2,...) => {
if (event.currentTarget.name === "button1") {
history.push(from)
}
}
<Formik>
//... fields
<button name="button1" label="save" onClick={(event) => handleSubmit(event,param1,param2,...)} />
<button name="button2" label="save & close" onClick={(event) => handleSubmit(event,...)} />
</formik>
中:
SizedBox()
结果:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。