小编Var*_*ain的帖子

TextFormField 中的提示文本与前缀和后缀图标不对齐

与前缀和后缀图标相比,文本表单字段中的提示文本有点升高(感觉好像与两个图标相比是向上的)。

在此输入图像描述

我还附上了用于此 TextFormfield 的代码:

TextFormField(
            style:
                w400.size12.copyWith(color: BrandColor.foodsearchViewTextColor),
            cursorColor: BrandColor.foodsearchViewTextColor,
            decoration: InputDecoration(
                prefixIcon: Padding(
                  padding: const EdgeInsets.only(right: 18.0),
                  child: IconButton(
                    icon: SvgPicture.asset(
                      SvgAssets.food_search_icon,
                      color: BrandColor.foodsearchViewTextColor,
                    ),
                    onPressed: null,
                  ),
                ),
                suffixIcon: Padding(
                  padding: const EdgeInsets.only(right: 14.0),
                  child: IconButton(
                    icon: SvgPicture.asset(
                      SvgAssets.food_searchview_suffix,
                      color: BrandColor.foodsearchViewTextColor,
                    ),
                    onPressed: null,
                  ),
                ),
                focusedBorder: InputBorder.none,
                enabledBorder: InputBorder.none,
                errorBorder: InputBorder.none,
                disabledBorder: InputBorder.none,
                focusedErrorBorder: InputBorder.none,
                border: InputBorder.none,
                hintText: foodSearchText,
                hintStyle: w400.size12.copyWith(
                    color: BrandColor.foodsearchViewTextColor, fontSize: 13)),
          ),
Run Code Online (Sandbox Code Playgroud)

我也尝试用中心小部件包装文本表单字段,但它没有解决问题。如果有人可以提供帮助,我将非常感激

android-edittext flutter flutter-layout textformfield flutter-textformfield

2
推荐指数
1
解决办法
5994
查看次数