Skip to content

Commit

Permalink
Animate camera to move to any position
Browse files Browse the repository at this point in the history
  • Loading branch information
Usaid-Dev committed Mar 8, 2023
1 parent ed4fd39 commit 4843c65
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions lib/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,32 @@ class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: GoogleMap(
initialCameraPosition: _kGooglePlex,
markers: Set<Marker>.of(_marker),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
body: SafeArea(
child: GoogleMap(
initialCameraPosition: _kGooglePlex,
markers: Set<Marker>.of(_marker),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
),
),
floatingActionButton: FloatingActionButton(
onPressed: () async {
GoogleMapController controller = await _controller.future;
controller.animateCamera(
CameraUpdate.newCameraPosition(
const CameraPosition(
target: LatLng(
24.88453,
67.07886,
),
zoom: 14,
),
),
);
setState(() {});
},
child: const Icon(Icons.location_disabled_outlined),
),
);
}
Expand Down

0 comments on commit 4843c65

Please sign in to comment.