Flutter新手引导

1、第三方框架showcaseview https://pub-web.flutter-io.cn/packages/showcaseview

2、OverlayScreen配合ColorFiltered实现扣洞

一搜很多,就不重复写了,只是记录一下项目里之前正常,最近突然出现的bug:
下面的代码在我更新了Flutter之后运行,ColorFiltered不展示背景色了

核心代码:

ColorFiltered(
      colorFilter: const ColorFilter.mode(
        Colors.grey,//背景色
        BlendMode.srcOut,
      ),
      child: Stack(
        children: [
          // 固定写法
          Positioned.fill(
            child: Container(
              color: Colors.transparent,
            ),
          ),
          // 扣洞的位置
          Positioned(
            top: 100,
            left: 100,
            child: Container(
              color: Colors.black,
              height: 100,
              width: 100,
            ),
          ),
        ],
      ),
    )

找了半天发现是 固定写法 那里的实现有问题,需要指定backgroundBlendMode,改成这样就可以了:

// 固定写法
Container(
      decoration: const BoxDecoration(
        color: Colors.white,
        backgroundBlendMode: BlendMode.dstOut,
      ),
    )

从这里找到的解决办法
惊天秘密!如何在 Flutter 项目中实现操作引导

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容