From 53ec2b314d28be5e63a1f9e7b58927ddb699108c Mon Sep 17 00:00:00 2001 From: tim Hoogstrate Date: Tue, 5 Mar 2024 12:35:19 +0100 Subject: [PATCH] Added setting of locale to example app. --- geocoding_ios/CHANGELOG.md | 8 +++-- .../lib/plugin_example/geocode_page.dart | 32 +++++++++++++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/geocoding_ios/CHANGELOG.md b/geocoding_ios/CHANGELOG.md index e3fc531..b55455f 100644 --- a/geocoding_ios/CHANGELOG.md +++ b/geocoding_ios/CHANGELOG.md @@ -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 diff --git a/geocoding_ios/example/lib/plugin_example/geocode_page.dart b/geocoding_ios/example/lib/plugin_example/geocode_page.dart index 1d99345..5fff783 100644 --- a/geocoding_ios/example/lib/plugin_example/geocode_page.dart +++ b/geocoding_ios/example/lib/plugin_example/geocode_page.dart @@ -14,6 +14,7 @@ class _GeocodeWidgetState extends State { final TextEditingController _latitudeController = TextEditingController(); final TextEditingController _longitudeController = TextEditingController(); String _output = ''; + GeocodingIOS _geocodingIOS = GeocodingIOS(); @override void initState() { @@ -74,7 +75,7 @@ class _GeocodeWidgetState extends State { final latitude = double.parse(_latitudeController.text); final longitude = double.parse(_longitudeController.text); - GeocodingIOS() + _geocodingIOS .placemarkFromCoordinates(latitude, longitude) .then((placemarks) { var output = 'No results found.'; @@ -107,7 +108,7 @@ class _GeocodeWidgetState extends State { child: ElevatedButton( child: Text('Look up location'), onPressed: () { - GeocodingIOS() + _geocodingIOS .locationFromAddress(_addressController.text) .then((locations) { var output = 'No results found.'; @@ -128,7 +129,7 @@ class _GeocodeWidgetState extends State { 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"; @@ -137,6 +138,31 @@ class _GeocodeWidgetState extends State { }); }); })), + 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(