簡體   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