簡體   English   中英

如何從 Flutter 中的 ModalBottomSheet 更改投影(或陰影)

[英]How to change the drop shadow (or shade) from a ModalBottomSheet in Flutter

ModalBottomSheet 自動在底層 Screen 上呈現陰影或陰影。

showModalBottomSheet方法中將背景顏色設置為透明只會影響包含子窗口小部件的區域。
它不會刪除模態下的陰影。

我可以刪除或更改陰影的不透明度嗎?

showModalBottomSheet(
        barrierColor: Colors.white.withOpacity(0),
...

請注意,我正在使用屬性“barrierColor”

如果你想增加或減少陰影,你可以改變elevation:

showModalBottomSheet<void>(
    elevation: 2.0,
      context: context,
      builder: (BuildContext context) {

0 表示沒有陰影,使用 2.0 的倍數

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM