Flutter TextFormField 填充不尊重内部孩子

问题描述

我正在使用 Flutter web 并且我有一个 TextFormField,当我设置 isDense=true 并添加 contentPadding 时,它不考虑内部文本大小的大小。因此,将 contentPadding 设置为 EdgeInsets.only(top: 8),实际上并没有向文本的 top 添加 8 个像素,而只是向整个字段垂直添加 8 个像素。

我如何设置尊重内部孩子的自定义填充,类似于如何在尊重内部孩子的容器小部件上设置“填充”属性

        TextFormField(
          controller: controller,obscureText: obscureText,style: theme.textTheme.subtitle2,decoration: Inputdecoration(
            focusedBorder: OutlineInputBorder(
              borderSide: BorderSide(color: theme.highlightColor),),border: OutlineInputBorder(),isDense: true,contentPadding: const EdgeInsets.only(left: 7,top: 7,bottom: 8),// this does respect inner text
            labelText: this.placeholder,floatingLabelBehavior: FloatingLabelBehavior.never,labelStyle: theme.textTheme.subtitle2.apply(
              color: theme.unselectedWidgetColor,)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)