您可以将前景中的动作小部件跳过到另一个小部件吗?

问题描述

我在 GoogleMap 上方使用 Lottie 但我有问题我无法移动 GoogleMap 在图片的框架中 例如,当我用手指在地图内移动时 它工作正常,但在 Lottie 的边缘不起作用 我可以跳过 Lottie 移动地图吗好像它不存在

enter image description here

那是我的代码

Stack(
        children: [
          GoogleMap(
            padding: EdgeInsets.only(bottom: bottomPosition),myLocationButtonEnabled: false,initialCameraPosition: _cameraPosition,myLocationEnabled: true,onCameraMoveStarted: () {
              setState(() {
                _controllerAnimation.forward(from: 0.0);
              });
            },onCameraIdle: () {
              setState(() {
                _controllerAnimation.forward(from: 0.65);
              });
            },onMapCreated: (GoogleMapController controller) async {
              _controller.complete(controller);
              _googleMapController = controller;
             

            },),Positioned(
              top: (mapHeight - iconSize - 180) / 2,right: (mapWidth - iconSize - 60) / 2,child: Lottie.asset("assets/json_assets/expanding_marker.json",width: 128,height: 160,repeat: false,controller: _controllerAnimation,onLoaded: (composition) {
                    _controllerAnimation.duration = composition.duration;
                    _controllerAnimation.forward(from: 0.50);
                    _controllerAnimation.stop(canceled: true);
                  })
          ),])

如果没有办法解决,有没有别的办法。

解决方法

试试这个:

Positioned(
              top: (mapHeight - iconSize - 180) / 2,right: (mapWidth - iconSize - 60) / 2,child: 
IgnorePointer(ignoring: true,child:
Lottie.asset("assets/json_assets/expanding_marker.json",width: 128,height: 160,repeat: false,controller: _controllerAnimation,onLoaded: (composition) {
                    _controllerAnimation.duration = composition.duration;
                    _controllerAnimation.forward(from: 0.50);
                    _controllerAnimation.stop(canceled: true);
                  })
          ),),])