Flutter 如何将文本字段输入保持垂直居中?
我想在Flutter 如何将文本字段输入保持垂直居中?,flutter,dart,Flutter,Dart,我想在容器中放入文本文件。但是我发现在容器中输入的内容不能保持垂直方向的准确性(稍微高一点),但是两个图标显示得很好。有办法解决我的情况吗? 按照@暗杀者的建议试试这个 InputDecoration( prefixIcon: MyIcon.SearchGreyIcon, hintText: 'hint text here', hintStyle: MyTextStyle.grey, border: InputBorder.non
容器中放入文本文件
。但是我发现在容器中输入的内容不能保持垂直方向的准确性(稍微高一点),但是两个图标显示得很好。有办法解决我的情况吗?
按照@暗杀者的建议试试这个
InputDecoration(
prefixIcon: MyIcon.SearchGreyIcon,
hintText: 'hint text here',
hintStyle: MyTextStyle.grey,
border: InputBorder.none,
filled: true,
suffixIcon: focusNode.hasFocus
? IconButton(
icon: MyIcon.CloseIcon,
onPressed: () => inputController.clear(),
)
: Container(),
)
你能试试filled:true,contentPadding:EdgeInsets.all(15)
indecoration:InputDecoration()
@byhuang1998@Assassin是的,很有效,谢谢你的帮助。我能麻烦你向我解释一下它的原理吗?哦,谢谢你的建议,它很管用。你能给我解释一下它的原理吗?更多信息请访问这里
InputDecoration(
prefixIcon: MyIcon.SearchGreyIcon,
hintText: 'hint text here',
hintStyle: MyTextStyle.grey,
border: InputBorder.none,
filled: true,
suffixIcon: focusNode.hasFocus
? IconButton(
icon: MyIcon.CloseIcon,
onPressed: () => inputController.clear(),
)
: Container(),
)