From af3145b3e6d8716fba000ab4f314a8f7a95ae2c0 Mon Sep 17 00:00:00 2001 From: Gustavo Cevallos Date: Thu, 27 May 2021 22:00:12 -0500 Subject: [PATCH 1/3] Add buttonMargin to showLocationPicker Add button margin to float button in maps --- lib/src/google_map_location_picker.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/google_map_location_picker.dart b/lib/src/google_map_location_picker.dart index b06dfda0..f6f9fade 100644 --- a/lib/src/google_map_location_picker.dart +++ b/lib/src/google_map_location_picker.dart @@ -40,6 +40,7 @@ class LocationPicker extends StatefulWidget { this.countries, this.language, this.desiredAccuracy, + this.buttonMargin, }); final String apiKey; @@ -66,6 +67,8 @@ class LocationPicker extends StatefulWidget { final String language; final LocationAccuracy desiredAccuracy; + final EdgeInsets buttonMargin; + @override LocationPickerState createState() => LocationPickerState(); @@ -425,6 +428,7 @@ class LocationPickerState extends State { key: mapKey, language: widget.language, desiredAccuracy: widget.desiredAccuracy, + buttonMargin: widget.buttonMargin, ), ); }), @@ -462,6 +466,7 @@ Future showLocationPicker( Decoration resultCardDecoration, String language = 'en', LocationAccuracy desiredAccuracy = LocationAccuracy.best, + EdgeInsets buttonMargin = EdgeInsets.only(top: kToolbarHeight + 50, right: 8), }) async { final results = await Navigator.of(context).push( MaterialPageRoute( @@ -487,6 +492,7 @@ Future showLocationPicker( countries: countries, language: language, desiredAccuracy: desiredAccuracy, + buttonMargin: buttonMargin, ); }, ), From 3c54ea7f780d8f24cb0e67bfc3df77eed047aa60 Mon Sep 17 00:00:00 2001 From: Gustavo Cevallos Date: Thu, 27 May 2021 22:23:46 -0500 Subject: [PATCH 2/3] Add const to buttonMargin --- lib/src/google_map_location_picker.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/google_map_location_picker.dart b/lib/src/google_map_location_picker.dart index f6f9fade..a0efaff7 100644 --- a/lib/src/google_map_location_picker.dart +++ b/lib/src/google_map_location_picker.dart @@ -69,7 +69,6 @@ class LocationPicker extends StatefulWidget { final LocationAccuracy desiredAccuracy; final EdgeInsets buttonMargin; - @override LocationPickerState createState() => LocationPickerState(); } @@ -466,7 +465,8 @@ Future showLocationPicker( Decoration resultCardDecoration, String language = 'en', LocationAccuracy desiredAccuracy = LocationAccuracy.best, - EdgeInsets buttonMargin = EdgeInsets.only(top: kToolbarHeight + 50, right: 8), + EdgeInsets buttonMargin = + const EdgeInsets.only(top: kToolbarHeight + 50, right: 8), }) async { final results = await Navigator.of(context).push( MaterialPageRoute( From e4cbd9d704101f59e711041184f021466da83124 Mon Sep 17 00:00:00 2001 From: Gustavo Cevallos Date: Thu, 27 May 2021 22:23:56 -0500 Subject: [PATCH 3/3] Add buttonMargin in the map --- lib/src/map.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/map.dart b/lib/src/map.dart index eca20b2c..6ccf8e06 100644 --- a/lib/src/map.dart +++ b/lib/src/map.dart @@ -38,6 +38,7 @@ class MapPicker extends StatefulWidget { this.resultCardPadding, this.language, this.desiredAccuracy, + this.buttonMargin, }) : super(key: key); final String apiKey; @@ -64,6 +65,8 @@ class MapPicker extends StatefulWidget { final LocationAccuracy desiredAccuracy; + final EdgeInsets buttonMargin; + @override MapPickerState createState() => MapPickerState(); } @@ -202,6 +205,7 @@ class MapPickerState extends State { layersButtonEnabled: widget.layersButtonEnabled, onToggleMapTypePressed: _onToggleMapTypePressed, onMyLocationPressed: _initCurrentLocation, + buttonMargin: widget.buttonMargin, ), pin(), locationCard(), @@ -452,6 +456,7 @@ class _MapFabs extends StatelessWidget { @required this.layersButtonEnabled, @required this.onToggleMapTypePressed, @required this.onMyLocationPressed, + @required this.buttonMargin, }) : assert(onToggleMapTypePressed != null), super(key: key); @@ -460,12 +465,12 @@ class _MapFabs extends StatelessWidget { final VoidCallback onToggleMapTypePressed; final VoidCallback onMyLocationPressed; - + final EdgeInsets buttonMargin; @override Widget build(BuildContext context) { return Container( alignment: Alignment.topRight, - margin: const EdgeInsets.only(top: kToolbarHeight + 24, right: 8), + margin: buttonMargin, child: Column( children: [ if (layersButtonEnabled)