简体   繁体   English

使用颤振创建玻璃 UI

[英]Create glass UI with flutter

as title say I'd like to create a ui like this but I can't obtain the same result.正如标题所说,我想创建一个这样的用户界面,但我无法获得相同的结果。

在此处输入图像描述

Right now I'm using this code:现在我正在使用这段代码:

 @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        image: DecorationImage(
          image: AssetImage('images/greydrop.jpeg'),
          fit: BoxFit.cover,
        ),
      ),
      child: BackdropFilter(
        filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
        child: Scaffold(
          backgroundColor: Colors.white.withOpacity(0.6),
          appBar: AppBar(...),
          body : ....



I'm using an image with different type of grey.我正在使用具有不同类型灰色的图像。 My result is the follow :我的结果如下: 在此处输入图像描述

As you are using a plain grey image you cannot see the distortion happening I guess.当您使用纯灰色图像时,我猜您看不到失真的发生。

Try using a colored background like THIS in the same code.尝试在同一代码中使用像THIS这样的彩色背景。

you can use simple "glassy" library.您可以使用简单的“玻璃”库。 https://pub.dev/packages/glassy https://pub.dev/packages/glassy

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

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