简体   繁体   English

Flutter 中 TextField 的默认填充是什么?

[英]What is the default padding for TextField in Flutter?

Dear Flutter Developers,亲爱的 Flutter 开发者,

I want to know the default value used in contentPadding property inside InputDecoration() for TextField or TextFormField in Flutter.我想知道 Flutter 中TextFieldTextFormFieldInputDecoration()contentPadding属性中使用的默认值。

According to the Flutter documentation here: Flutter > material > InputDecoration > contentPadding根据此处的 Flutter 文档: Flutter > material > InputDecoration > contentPadding

By default the contentPadding reflects [isDense] and the type of the [border].默认情况下, contentPadding反映 [isDense] 和 [border] 的类型。

If [isCollapsed] is true then contentPadding is [EdgeInsets.zero].如果 [isCollapsed] 为真,则contentPadding为 [EdgeInsets.zero]。

If isOutline property of [border] is false and if [filled] is true then contentPadding is EdgeInsets.fromLTRB(12, 8, 12, 8) when [isDense] is true and EdgeInsets.fromLTRB(12, 12, 12, 12) when [isDense] is false.如果 [border] 的isOutline属性为 false 且 [filled] 为 true 则contentPaddingEdgeInsets.fromLTRB(12, 8, 12, 8)当 [isDense] 为 true 且EdgeInsets.fromLTRB(12, 12, 12, 12)当 [isDense] 为假时。

If isOutline property of [border] is false and if [filled] is false then contentPadding is EdgeInsets.fromLTRB(0, 8, 0, 8) when [isDense] is true and EdgeInsets.fromLTRB(0, 12, 0, 12) when [isDense] is false.如果 [border] 的isOutline属性为 false 且 [filled] 为 false 则contentPaddingEdgeInsets.fromLTRB(0, 8, 0, 8)当 [isDense] 为 true 且EdgeInsets.fromLTRB(0, 12, 0, 12)当 [isDense] 为假时。

If isOutline property of [border] is true then contentPadding is EdgeInsets.fromLTRB(12, 20, 12, 12) when [isDense] is true and EdgeInsets.fromLTRB(12, 24, 12, 16) when [isDense] is false.如果 [border] 的isOutline属性为 true,那么当 [isDense] 为 true 时contentPaddingEdgeInsets.fromLTRB(12, 20, 12, 12) ,当 [isDense] 为 false 时为EdgeInsets.fromLTRB(12, 24, 12, 16)

NOTE: The value of isOutline property is true for OutlineInputBorder() and is false for UnderlineInputBorder()注意: isOutline属性的值对于OutlineInputBorder()true ,对于UnderlineInputBorder()false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM