11import 'dart:async' ;
2+ import 'dart:ui' as ui;
23
34import 'package:baseflow_plugin_template/baseflow_plugin_template.dart' ;
45import 'package:flutter/material.dart' ;
@@ -40,7 +41,8 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
4041 (Geocoder , GeocodeListener ) _createGeocoderWithListener () {
4142 final geocoderInstance = Geocoder (
4243 locale: Locale (
43- identifier: _locale ?? Localizations .localeOf (context).toString (),
44+ identifier:
45+ _locale ?? ui.PlatformDispatcher .instance.locale.languageCode,
4446 ),
4547 );
4648
@@ -62,13 +64,13 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
6264 void initState () {
6365 super .initState ();
6466
65- _addressController.text = 'Gronausestraat 710, Enschede ' ;
67+ _addressController.text = 'Gronausestraat' ;
6668 _latitudeController.text = '52.2165157' ;
6769 _longitudeController.text = '6.9437819' ;
68- _lowerLeftLatitudeBoundController.text = '52.21514 ' ;
69- _lowerLeftLongitudeBoundController.text = '6.94417 ' ;
70- _upperRightLatitudeBoundController.text = '52.21814 ' ;
71- _upperRightLongitudeBoundController.text = '6.94817 ' ;
70+ _lowerLeftLatitudeBoundController.text = '52.207778 ' ;
71+ _lowerLeftLongitudeBoundController.text = '6.925356 ' ;
72+ _upperRightLatitudeBoundController.text = '52.224816 ' ;
73+ _upperRightLongitudeBoundController.text = '6.979773 ' ;
7274 }
7375
7476 Future <void > _buildOutputFromAddresses (List <Address ?> addresses) async {
@@ -87,13 +89,12 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
8789 final lng = await address.getLongitude ();
8890
8991 buffer.writeln ('--- Address ${i + 1 } ---' );
90- buffer.writeln (' Address line: $addressLine ' );
91- buffer.writeln (' Locality: $locality ' );
92- buffer.writeln (' Admin area: $adminArea ' );
93- buffer.writeln (' Country: $countryName ' );
94- buffer.writeln (' Postal code: $postalCode ' );
95- buffer.writeln (' Lat/Lng: $lat , $lng ' );
96- buffer.writeln ();
92+ buffer.writeln ('Address line: $addressLine ' );
93+ buffer.writeln ('Locality: $locality ' );
94+ buffer.writeln ('Admin area: $adminArea ' );
95+ buffer.writeln ('Country: $countryName ' );
96+ buffer.writeln ('Postal code: $postalCode ' );
97+ buffer.writeln ('Lat/Lng: $lat , $lng ' );
9798 }
9899
99100 if (buffer.isEmpty) {
@@ -164,8 +165,8 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
164165 value: Localizations .localeOf (context).toString (),
165166 label: 'Default locale' ,
166167 ),
167- DropdownMenuEntry <String >(value: 'US ' , label: 'English (US)' ),
168- DropdownMenuEntry <String >(value: 'NL ' , label: 'Nederlands (NL)' ),
168+ DropdownMenuEntry <String >(value: 'en ' , label: 'English (US)' ),
169+ DropdownMenuEntry <String >(value: 'nl ' , label: 'Nederlands (NL)' ),
169170 ],
170171 onSelected: (String ? value) => setState (() => _locale = value),
171172 ),
@@ -257,6 +258,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
257258 decoration: const InputDecoration (hintText: 'Address' ),
258259 keyboardType: TextInputType .text,
259260 ),
261+ const Padding (padding: EdgeInsets .only (top: 8 )),
260262 Row (
261263 children: < Widget > [
262264 Expanded (
@@ -284,6 +286,7 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
284286 ),
285287 ],
286288 ),
289+ const Padding (padding: EdgeInsets .only (top: 8 )),
287290 Row (
288291 children: < Widget > [
289292 Expanded (
@@ -353,11 +356,3 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
353356 );
354357 }
355358}
356-
357- // Only take a look at the geocoder.dart inside the pigeons folder.
358-
359- // getFromLocationName
360-
361- // isPresent
362-
363- // GeographicBounds
0 commit comments