Flutter新手引导

2023-07-16  本文已影响0人  oldSix_Zhu

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 项目中实现操作引导

上一篇下一篇

猜你喜欢

热点阅读