The Google Maps zoom +/- buttons does not appear on iOS. You can double tap to zoom on iOS, but we can't expect users to know how to do that.
Find this issue also here : https://github.com/flutter/flutter/issues/140741
iOS support for Google Maps zoom controls
Actions & Logic
custom widget but doesnt work
// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:google_maps_flutter/google_maps_flutter.dart' as gmaps;
class CustomZoomableMap extends StatefulWidget {
final gmaps.LatLng initialPosition; // Position initiale de la carte
final double width; // Largeur du widget
final double height; // Hauteur du widget
const CustomZoomableMap({
Key? key,
required this.initialPosition,
required this.width,
required this.height,
}) : super(key: key);
@override
_CustomZoomableMapState createState() => _CustomZoomableMapState();
}
class _CustomZoomableMapState extends State<CustomZoomableMap> {
late gmaps.GoogleMapController _controller;
double _currentZoom = 14.0; // Niveau de zoom initial
// Fonction pour zoomer
void _zoomIn() {
setState(() {
_currentZoom = (_currentZoom + 1).clamp(2, 20);
_controller.animateCamera(
gmaps.CameraUpdate.zoomTo(_currentZoom),
);
});
}
// Fonction pour dézoomer
void _zoomOut() {
setState(() {
_currentZoom = (_currentZoom - 1).clamp(2, 20);
_controller.animateCamera(
gmaps.CameraUpdate.zoomTo(_currentZoom),
);
});
}
@override
Widget build(BuildContext context) {
return SizedBox(
width: widget.width,
height: widget.height,
child: Stack(
children: [
// Carte Google Map
gmaps.GoogleMap(
initialCameraPosition: gmaps.CameraPosition(
target: widget.initialPosition,
zoom: _currentZoom,
),
onMapCreated: (gmaps.GoogleMapController controller) {
_controller = controller;
},
),
// Bouton Zoom In
Positioned(
top: 10,
right: 10,
child: FloatingActionButton(
onPressed: _zoomIn,
mini: true,
backgroundColor: Colors.white,
child: const Icon(Icons.add),
),
),
// Bouton Zoom Out
Positioned(
top: 70,
right: 10,
child: FloatingActionButton(
onPressed: _zoomOut,
mini: true,
backgroundColor: Colors.white,
child: const Icon(Icons.remove),
),
),
],
),
);
}
}
No
1