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

Added geocoding locale to the Android example app #211

Merged
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
4 changes: 4 additions & 0 deletions geocoding_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.3.0

* Added `setLocaleIdentifier` to the Android example app.

## 3.2.0

* Exposes isPresent() call that returns true if there is a geocoder implementation present that may return results.
Expand Down
35 changes: 31 additions & 4 deletions geocoding_android/example/lib/plugin_example/geocode_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
final TextEditingController _longitudeController = TextEditingController();
String _output = '';

GeocodingAndroid _geocodingAndroid = GeocodingAndroid();

@override
void initState() {
_addressController.text = 'Gronausestraat 710, Enschede';
Expand Down Expand Up @@ -74,7 +76,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
final latitude = double.parse(_latitudeController.text);
final longitude = double.parse(_longitudeController.text);

GeocodingAndroid()
_geocodingAndroid
.placemarkFromCoordinates(latitude, longitude)
.then((placemarks) {
var output = 'No results found.';
Expand Down Expand Up @@ -107,7 +109,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
child: ElevatedButton(
child: Text('Look up address'),
onPressed: () {
GeocodingAndroid()
_geocodingAndroid
.placemarkFromAddress(_addressController.text)
.then((locations) {
var output = 'No results found.';
Expand Down Expand Up @@ -140,7 +142,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
child: ElevatedButton(
child: Text('Look up location'),
onPressed: () {
GeocodingAndroid()
_geocodingAndroid
.locationFromAddress(_addressController.text)
.then((locations) {
var output = 'No results found.';
Expand All @@ -161,7 +163,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
child: ElevatedButton(
child: Text('Is present'),
onPressed: () {
GeocodingAndroid().isPresent().then((isPresent) {
_geocodingAndroid.isPresent().then((isPresent) {
var output = isPresent
? "Geocoder is present"
: "Geocoder is not present";
Expand All @@ -171,6 +173,31 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
});
}),
),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('Set locale en_US'),
onPressed: () {
_geocodingAndroid.setLocaleIdentifier("en_US").then((_) {
//locale set
});
})),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('Set locale nl_NL'),
onPressed: () {
_geocodingAndroid.setLocaleIdentifier("nl_NL").then((_) {
//locale set
});
})),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Expanded(
child: SingleChildScrollView(
child: Container(
Expand Down
2 changes: 1 addition & 1 deletion geocoding_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: geocoding_android
description: A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features.
version: 3.2.0
version: 3.3.0
repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_android
issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues

Expand Down