【问题标题】:Transparent container in flutter颤动中的透明容器
【发布时间】:2020-01-28 01:02:49
【问题描述】:

我是 Flutter 的初学者,正在尝试在 Flutter 中制作一个透明的容器。它应该与背景 100% 透明。我尝试使用 Colors.transparent 作为 containercolor 属性,但这不是我想要的。

【问题讨论】:

    标签: flutter dart containers transparent


    【解决方案1】:

    尝试使用opacity 小部件。在此示例中添加您的容器而不是 MyTransparentWidget(),就是这样。

     Opacity(
                opacity: 0,
                child: Card(
                  elevation: 5,
                  child: <YOUR WIDGET>,
                ),
              ),
    

    【讨论】:

    • 感谢您的建议,但这使它完全不可见。我想要 link 中提供的 image 中显示的 Appbar 之类的东西。它的边框应该是可见的,但应该看起来像一个空心容器。
    • 我已经更新了答案,请检查。这对你有用
    • 感谢您的建议,但没有为容器提供任何颜色属性,您就已经使其成为透明的。无需使用不透明度小部件。
    • @ShivamSingh 您可以将属性设置为“backgroundColor: Colors.transparent”
    猜你喜欢
    • 2019-12-04
    • 2019-08-13
    • 2020-09-16
    • 2021-05-10
    • 2021-12-25
    • 1970-01-01
    • 2016-02-15
    • 2021-04-03
    • 1970-01-01
    相关资源
    最近更新 更多