【发布时间】:2022-08-02 19:48:37
【问题描述】:
所以基本上我正在尝试创建一个稍微不透明的容器。我正在使用.withOpacity(...); 方法但是我没有得到我想要的确切外观。我想要的外观是在 Apple Music 中:
它就像它不是不透明的,而是像玻璃,有雾的玻璃。
编辑:这是我到目前为止所拥有的:
Widget opaqueContainer(BuildContext context) {
final bool themeIsDark = true; // will use state manager here when implemented.
return Container(
height: 100,
width: 100,
color: themeIsDark ? Colors.black.withOpacity(0.7) : Colors.white.withOpacity(0.85),
child: IconButton(
onPressed: () {},
icon: const Icon(CupertinoIcons.phone, color: primary),
),
);
}
我怎样才能创造这种颜色?
-
请发布您目前拥有的现有代码。创造这种效果需要的不仅仅是颜色,而且很难在没有看到代码的情况下回答到底需要做什么:)
-
@RohanThacker 好的。更新。我真的没有多少。老实说,我认为这只是不透明哈哈。
-
它是目前流行的设计模式,“Glassmorphism”如果您想了解更多信息,请查看here 的更多信息