diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 00000000..40ffe81d --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=C:\flutter" +export "FLUTTER_APPLICATION_PATH=D:\Testes\google_map_location_picker\example" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build\ios" +export "OTHER_LDFLAGS=$(inherited) -framework Flutter" +export "FLUTTER_FRAMEWORK_DIR=C:\flutter\bin\cache\artifacts\engine\ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1.0.0" diff --git a/example/lib/main.dart b/example/lib/main.dart index b1c8c83f..265ab5d6 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -3,7 +3,6 @@ import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:google_map_location_picker/generated/i18n.dart' as location_picker; import 'package:google_map_location_picker/google_map_location_picker.dart'; -import 'package:google_map_location_picker_example/keys.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'generated/i18n.dart'; @@ -49,7 +48,7 @@ class _MyAppState extends State { onPressed: () async { LocationResult result = await showLocationPicker( context, - apiKey, + "Your Api Key", initialCenter: LatLng(31.1975844, 29.9598339), // automaticallyAnimateToCurrentLocation: true, // mapStylePath: 'assets/mapStyle.json', diff --git a/example/pubspec.lock b/example/pubspec.lock index 8db3e862..56716a36 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -21,42 +21,42 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.14.12" convert: dependency: transitive description: @@ -70,7 +70,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.4" csslib: dependency: transitive description: @@ -155,7 +155,7 @@ packages: path: ".." relative: true source: path - version: "3.3.0" + version: "3.3.1" google_maps_flutter: dependency: transitive description: @@ -197,14 +197,14 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.12" intl: dependency: "direct main" description: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.0" + version: "0.16.1" intl_translation: dependency: "direct main" description: @@ -316,7 +316,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -328,7 +328,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" stack_trace: dependency: transitive description: @@ -370,7 +370,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" typed_data: dependency: transitive description: @@ -398,7 +398,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.6.1" yaml: dependency: transitive description: diff --git a/lib/src/google_map_location_picker.dart b/lib/src/google_map_location_picker.dart index 3cd7428e..0257b753 100644 --- a/lib/src/google_map_location_picker.dart +++ b/lib/src/google_map_location_picker.dart @@ -34,6 +34,9 @@ class LocationPicker extends StatefulWidget { this.resultCardAlignment, this.resultCardDecoration, this.resultCardPadding, + this.customLocationCard, + this.appBar, + this.customPin, }); final String apiKey; @@ -54,7 +57,10 @@ class LocationPicker extends StatefulWidget { final Alignment resultCardAlignment; final Decoration resultCardDecoration; final EdgeInsets resultCardPadding; - + final AppBar appBar; + final Function(BuildContext context, LocationProvider locationProvider) + customLocationCard; + final Widget customPin; @override LocationPickerState createState() => LocationPickerState(); } @@ -362,18 +368,19 @@ class LocationPickerState extends State { child: Builder(builder: (context) { return Scaffold( extendBodyBehindAppBar: true, - appBar: AppBar( - iconTheme: Theme.of(context).iconTheme, - elevation: 0, - backgroundColor: widget.appBarColor, - key: appBarKey, - title: SearchInput( - (input) => searchPlace(input), - key: searchInputKey, - boxDecoration: widget.searchBarBoxDecoration, - hintText: widget.hintText, - ), - ), + appBar: widget.appBar ?? + AppBar( + iconTheme: Theme.of(context).iconTheme, + elevation: 0, + backgroundColor: widget.appBarColor, + key: appBarKey, + title: SearchInput( + (input) => searchPlace(input), + key: searchInputKey, + boxDecoration: widget.searchBarBoxDecoration, + hintText: widget.hintText, + ), + ), body: MapPicker( widget.apiKey, initialCenter: widget.initialCenter, @@ -391,6 +398,8 @@ class LocationPickerState extends State { resultCardDecoration: widget.resultCardDecoration, resultCardPadding: widget.resultCardPadding, key: mapKey, + customLocationCard: widget.customLocationCard, + customPin: widget.customPin, ), ); }), @@ -424,6 +433,10 @@ Future showLocationPicker( AlignmentGeometry resultCardAlignment, EdgeInsetsGeometry resultCardPadding, Decoration resultCardDecoration, + Function(BuildContext context, LocationProvider locationProvider) + customLocationCard, + Widget customPin, + AppBar appBar, }) async { final results = await Navigator.of(context).push( MaterialPageRoute( @@ -444,6 +457,9 @@ Future showLocationPicker( resultCardAlignment: resultCardAlignment, resultCardPadding: resultCardPadding, resultCardDecoration: resultCardDecoration, + customLocationCard: customLocationCard, + appBar: appBar, + customPin: customPin, ); }, ), diff --git a/lib/src/map.dart b/lib/src/map.dart index bec73684..a041378d 100644 --- a/lib/src/map.dart +++ b/lib/src/map.dart @@ -35,6 +35,8 @@ class MapPicker extends StatefulWidget { this.resultCardAlignment, this.resultCardDecoration, this.resultCardPadding, + this.customLocationCard, + this.customPin, }) : super(key: key); final String apiKey; @@ -55,6 +57,10 @@ class MapPicker extends StatefulWidget { final Alignment resultCardAlignment; final Decoration resultCardDecoration; final EdgeInsets resultCardPadding; + final Function(BuildContext context, LocationProvider locationProvider) + customLocationCard; + + final Widget customPin; @override MapPickerState createState() => MapPickerState(); @@ -186,7 +192,7 @@ class MapPickerState extends State { onToggleMapTypePressed: _onToggleMapTypePressed, onMyLocationPressed: _initCurrentLocation, ), - pin(), + widget.customPin ?? pin(), locationCard(), ], ), @@ -198,52 +204,59 @@ class MapPickerState extends State { alignment: widget.resultCardAlignment ?? Alignment.bottomCenter, child: Padding( padding: widget.resultCardPadding ?? EdgeInsets.all(16.0), - child: Card( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), - child: Consumer( - builder: (context, locationProvider, _) { - return Padding( - padding: const EdgeInsets.all(16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - flex: 20, - child: FutureLoadingBuilder( - future: getAddress(locationProvider.lastIdleLocation), - mutable: true, - loadingIndicator: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CircularProgressIndicator(), - ], + child: widget.customLocationCard != null + ? Consumer( + builder: (context, locationProvider, _) { + return widget.customLocationCard(context, locationProvider); + }) + : Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8)), + child: Consumer( + builder: (context, locationProvider, _) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + flex: 20, + child: FutureLoadingBuilder( + future: + getAddress(locationProvider.lastIdleLocation), + mutable: true, + loadingIndicator: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircularProgressIndicator(), + ], + ), + builder: (context, address) { + _address = address; + return Text( + address ?? 'Unnamed place', + style: TextStyle(fontSize: 18), + ); + }), ), - builder: (context, address) { - _address = address; - return Text( - address ?? 'Unnamed place', - style: TextStyle(fontSize: 18), - ); - }), - ), - Spacer(), - FloatingActionButton( - onPressed: () { - Navigator.of(context).pop({ - 'location': LocationResult( - latLng: locationProvider.lastIdleLocation, - address: _address, - ) - }); - }, - child: widget.resultCardConfirmIcon ?? - Icon(Icons.arrow_forward), - ), - ], + Spacer(), + FloatingActionButton( + onPressed: () { + Navigator.of(context).pop({ + 'location': LocationResult( + latLng: locationProvider.lastIdleLocation, + address: _address, + ) + }); + }, + child: widget.resultCardConfirmIcon ?? + Icon(Icons.arrow_forward), + ), + ], + ), + ); + }), ), - ); - }), - ), ), ); } diff --git a/pubspec.lock b/pubspec.lock index 2d93bd56..98569a66 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,42 +21,42 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.14.12" convert: dependency: transitive description: @@ -70,7 +70,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.4" csslib: dependency: transitive description: @@ -183,14 +183,14 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.12" intl: dependency: "direct main" description: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.0" + version: "0.16.1" intl_translation: dependency: "direct main" description: @@ -302,7 +302,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -314,7 +314,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" stack_trace: dependency: "direct main" description: @@ -356,7 +356,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" typed_data: dependency: transitive description: @@ -384,7 +384,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.6.1" yaml: dependency: transitive description: