我开始将我的代码从使用标准Android库过渡到Flutter,这样我也可以快速部署到iOS设备上,但我只是担心TextField的比例;即Flutter的TextField比例与Android的EditText不同。
为了进行比较,这里是安卓的EditText:

这是Flutter的TextField:

有没有办法让Flutter TextField看起来更像Android EditText?下划线和占位符文本之间的空格让我很恼火,而且输入文本的大小比我预期的要小。如果RaisedButton看起来和普通的安卓按钮一模一样,为什么TextField不能做同样的事情呢?
发布于 2019-12-23 02:17:32
在InputDecoration中设置isDense: true。然后在InputDecoration中根据需要调整contentPadding
TextField(
decoration: InputDecoration(
hintText: "Username",
isDense: true,
contentPadding: EdgeInsets.symmetric( //You can also use EdgeInsets.only
horizontal: 0.0, //Change this
vertical: 0.0, //Change this
),
),
)请参阅演示here
https://stackoverflow.com/questions/59446697
复制相似问题