flutter google map lag

Viewed 293

i working on flutter with google map project . the implementation done by putting the map inside animated container as in this video

.enter image description here

the animation on iphone is perfectly smooth but on android done with lag. what i should do to make it better in animation

    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,
                             
                              ),
                            ),
                          )),
                    ],
                  ),
                ),
              ),
0 Answers
Related