繁体   English   中英

Flutter 小部件内的条件填充

[英]Conditional padding inside Flutter widget

我看到了条件颜色的这个答案

我正在尝试对填充做同样的事情

Padding(
  padding: const EdgeInsets.only(bottom: isLogin ? 58.0 : 10.0),
)

它不被接受。

谢谢

你可以像这样使用它:

            padding: isLogin
                ? EdgeInsets.only(bottom: 58.0)
                : EdgeInsets.only(bottom: 10.0),

编辑:

或者像这样删除const

            padding: EdgeInsets.only(bottom: isLogin ? 58.0 : 10.0),

您可以从这里阅读const的用法。

暂无
暂无

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

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