Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add margin for float button aka MapFabs #163

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/src/google_map_location_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class LocationPicker extends StatefulWidget {
this.countries,
this.language,
this.desiredAccuracy,
this.buttonMargin,
});

final String apiKey;
Expand All @@ -66,6 +67,7 @@ class LocationPicker extends StatefulWidget {
final String language;

final LocationAccuracy desiredAccuracy;
final EdgeInsets buttonMargin;

@override
LocationPickerState createState() => LocationPickerState();
Expand Down Expand Up @@ -425,6 +427,7 @@ class LocationPickerState extends State<LocationPicker> {
key: mapKey,
language: widget.language,
desiredAccuracy: widget.desiredAccuracy,
buttonMargin: widget.buttonMargin,
),
);
}),
Expand Down Expand Up @@ -462,6 +465,8 @@ Future<LocationResult> showLocationPicker(
Decoration resultCardDecoration,
String language = 'en',
LocationAccuracy desiredAccuracy = LocationAccuracy.best,
EdgeInsets buttonMargin =
const EdgeInsets.only(top: kToolbarHeight + 50, right: 8),
}) async {
final results = await Navigator.of(context).push(
MaterialPageRoute<dynamic>(
Expand All @@ -487,6 +492,7 @@ Future<LocationResult> showLocationPicker(
countries: countries,
language: language,
desiredAccuracy: desiredAccuracy,
buttonMargin: buttonMargin,
);
},
),
Expand Down
9 changes: 7 additions & 2 deletions lib/src/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class MapPicker extends StatefulWidget {
this.resultCardPadding,
this.language,
this.desiredAccuracy,
this.buttonMargin,
}) : super(key: key);

final String apiKey;
Expand All @@ -64,6 +65,8 @@ class MapPicker extends StatefulWidget {

final LocationAccuracy desiredAccuracy;

final EdgeInsets buttonMargin;

@override
MapPickerState createState() => MapPickerState();
}
Expand Down Expand Up @@ -202,6 +205,7 @@ class MapPickerState extends State<MapPicker> {
layersButtonEnabled: widget.layersButtonEnabled,
onToggleMapTypePressed: _onToggleMapTypePressed,
onMyLocationPressed: _initCurrentLocation,
buttonMargin: widget.buttonMargin,
),
pin(),
locationCard(),
Expand Down Expand Up @@ -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);

Expand All @@ -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: <Widget>[
if (layersButtonEnabled)
Expand Down