首页 > 解决方案 > 颤振谷歌地图滞后

问题描述

我正在与谷歌地图项目合作。通过将地图放入动画容器中完成的实现,如本视频所示

.在此处输入图像描述

iphone上的动画非常流畅,但在android上却有延迟。我应该怎么做才能使它在动画中变得更好

    AnimatedContainer(
                duration: const Duration(microseconds: 1000),
                width: _size.width,
                height: _shouldShow ? _size.height * 0.8 : 200,
                child: ClipRRect(
                  borderRadius: BorderRadius.circular(25.0),
                  child: Stack(
                    children: [
                      GoogleMap(
                        onMapCreated: _onMapCreated,
                        mapToolbarEnabled: true,
                        zoomControlsEnabled: false,
                        zoomGesturesEnabled: _shouldShow ? true : false,
                        scrollGesturesEnabled: _shouldShow ? true : false,
                  
                        myLocationButtonEnabled: false,
                        initialCameraPosition: CameraPosition(
                          target: _center,
                          zoom: _shouldShow ? _zoom : 11.0,
                        ),
                      ),
                      Positioned(
                          right: 0,
                          top: 10,
                          child: GestureDetector(
                            onTap: () {
                              print(_shouldShow);
                              setState(() {
                                _shouldShow
                                    ? _animationController.forward()
                                    : _animationController.reverse();
                                _animationController.reverse();

                                mapController.animateCamera(
                                  CameraUpdate.newCameraPosition(
                                    CameraPosition(
                                        target: _center, zoom: 11.0),
                                  ),
                                );
                                _shouldShow = !_shouldShow;
                                // _onMapCreated(mapController);
                              });
                            },
                            child: Container(
                              width: 46,
                              height: 46,
                              child: AnimatedIcon(
                                progress: _animationController,
                                icon: AnimatedIcons.close_menu,
                             
                              ),
                            ),
                          )),
                    ],
                  ),
                ),
              ),

标签: androidiosmacosflutterdart

解决方案


推荐阅读