Skip to content

Commit

Permalink
Added setting of locale to example app.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHoogstrate committed Mar 5, 2024
1 parent bb636ef commit 53ec2b3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
8 changes: 5 additions & 3 deletions geocoding_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
## 3.0.0

**Breaking Change**
* **BREAKING CHANGES**:
* Removes the `localeIdentifier` argument from all methods. Use method `setLocaleIdentifier` to configure the locale.
* Removes old iOS version checks and expects iOS 12 and above. (minimal iOS version is 12 per 2.2.0)
* Fixes to configure the locale.
* Removes the `localeIdentifier` argument from all methods. Use method `setLocaleIdentifier` to configure the locale.
* Removes old iOS version checks and expects iOS 12 and above. (minimal iOS version is 12 per 2.2.0)
* Updated example app with locale example.


## 2.3.0

Expand Down
32 changes: 29 additions & 3 deletions geocoding_ios/example/lib/plugin_example/geocode_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
final TextEditingController _latitudeController = TextEditingController();
final TextEditingController _longitudeController = TextEditingController();
String _output = '';
GeocodingIOS _geocodingIOS = GeocodingIOS();

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

GeocodingIOS()
_geocodingIOS
.placemarkFromCoordinates(latitude, longitude)
.then((placemarks) {
var output = 'No results found.';
Expand Down Expand Up @@ -107,7 +108,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
child: ElevatedButton(
child: Text('Look up location'),
onPressed: () {
GeocodingIOS()
_geocodingIOS
.locationFromAddress(_addressController.text)
.then((locations) {
var output = 'No results found.';
Expand All @@ -128,7 +129,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
child: ElevatedButton(
child: Text('Is present'),
onPressed: () {
GeocodingIOS().isPresent().then((isPresent) {
_geocodingIOS.isPresent().then((isPresent) {
var output = isPresent
? "Geocoder is present"
: "Geocoder is not present";
Expand All @@ -137,6 +138,31 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
});
});
})),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('Set locale en_US'),
onPressed: () {
_geocodingIOS.setLocaleIdentifier("en_US").then((_) {
setState(() {});
});
})),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('Set locale nl_NL'),
onPressed: () {
_geocodingIOS.setLocaleIdentifier("nl_NL").then((_) {
setState(() {});
});
})),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Expanded(
child: SingleChildScrollView(
child: Container(
Expand Down

0 comments on commit 53ec2b3

Please sign in to comment.