Flutter TextFormField: 限制输入框宽度
使用 TextFormField 组件可以设置输入框的宽度,可以通过设置 decoration 属性中的 contentPadding 属性来实现。例如:
TextFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(horizontal: 10.0),
border: OutlineInputBorder(),
),
)
其中,contentPadding 属性可以设置输入框内部的 padding,通过设置 horizontal 参数来限制宽度。同时,设置 border 属性可以添加输入框的边框。
原文地址: https://www.cveoy.top/t/topic/mSTU 著作权归作者所有。请勿转载和采集!