我正在使用谷歌地图项目处理颤振。通过将地图放入动画容器中完成的实现,如本视频所示
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,
),
),
)),
],
),
),
),