From 0e305ecdb619e8a19273eb2ef1a697aac40e08b9 Mon Sep 17 00:00:00 2001 From: hsnkrmn63 Date: Fri, 11 Oct 2024 16:13:04 +0300 Subject: [PATCH 1/3] bug fixed --- .flutter-plugins-dependencies | 1 + example/example.dart | 2 +- lib/widgets/place_picker.dart | 29 ++---- lib/widgets/rich_suggestion.dart | 15 ++- lib/widgets/search_input.dart | 6 +- pubspec.lock | 173 +++++++++++++++++++++---------- 6 files changed, 141 insertions(+), 85 deletions(-) create mode 100644 .flutter-plugins-dependencies diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies new file mode 100644 index 0000000..b9a93d2 --- /dev/null +++ b/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.2.1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.1.11/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.5/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_android-4.1.0/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.1.10/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.2.1/","native_build":true,"dependencies":[]}],"linux":[],"windows":[{"name":"geolocator_windows","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_windows-0.1.1/","native_build":true,"dependencies":[]}],"web":[{"name":"geolocator_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_web-2.1.6/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geolocator","dependencies":["geolocator_android","geolocator_apple","geolocator_web","geolocator_windows"]},{"name":"geolocator_android","dependencies":[]},{"name":"geolocator_apple","dependencies":[]},{"name":"geolocator_web","dependencies":[]},{"name":"geolocator_windows","dependencies":[]},{"name":"google_maps_flutter","dependencies":["google_maps_flutter_android","google_maps_flutter_ios"]},{"name":"google_maps_flutter_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_maps_flutter_ios","dependencies":[]}],"date_created":"2024-10-11 16:08:02.089937","version":"3.24.3","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/example/example.dart b/example/example.dart index 768db3f..71fda75 100644 --- a/example/example.dart +++ b/example/example.dart @@ -12,7 +12,7 @@ class PickerDemoState extends State { return Scaffold( appBar: AppBar(title: const Text('Picker Example')), body: Center( - child: FlatButton( + child: TextButton( child: Text("Pick Delivery location"), onPressed: () { showPlacePicker(); diff --git a/lib/widgets/place_picker.dart b/lib/widgets/place_picker.dart index dc2aec1..786330e 100644 --- a/lib/widgets/place_picker.dart +++ b/lib/widgets/place_picker.dart @@ -90,14 +90,9 @@ class PlacePickerState extends State { super.initState(); if (widget.displayLocation == null) { _getCurrentLocation().then((value) { - if (value != null) { - setState(() { - _currentLocation = value; - }); - } else { - //Navigator.of(context).pop(null); - print("getting current location null"); - } + setState(() { + _currentLocation = value; + }); setState(() { _loadMap = true; }); @@ -137,7 +132,7 @@ class PlacePickerState extends State { locationResult = null; _delayedPop(); return Future.value(false); - } else { + } else { return Future.value(true); } }, @@ -193,7 +188,8 @@ class PlacePickerState extends State { Padding( child: Text(widget.localizationItem!.nearBy, style: TextStyle(fontSize: 16)), - padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8), + padding: + EdgeInsets.symmetric(horizontal: 24, vertical: 8), ), Expanded( child: ListView( @@ -236,10 +232,6 @@ class PlacePickerState extends State { previousSearchTerm = place; - if (context == null) { - return; - } - clearOverlay(); setState(() { @@ -281,7 +273,7 @@ class PlacePickerState extends State { ), ); - Overlay.of(context)?.insert(this.overlayEntry!); + Overlay.of(context).insert(this.overlayEntry!); autoCompleteSearch(place); } @@ -397,7 +389,7 @@ class PlacePickerState extends State { ), ); - Overlay.of(context)?.insert(this.overlayEntry!); + Overlay.of(context).insert(this.overlayEntry!); } /// Utility function to get clean readable name of a location. First checks @@ -514,9 +506,6 @@ class PlacePickerState extends State { var tmp = result['address_components'][i]; var types = tmp["types"] as List; var shortName = tmp['short_name']; - if (types == null) { - continue; - } if (i == 0) { // [street_number] name = shortName; @@ -645,7 +634,7 @@ class PlacePickerState extends State { //moveToLocation(target); print('target:$target'); return target; - } on TimeoutException catch (e) { + } on TimeoutException { final locationData = await Geolocator.getLastKnownPosition(); if (locationData != null) { return LatLng(locationData.latitude, locationData.longitude); diff --git a/lib/widgets/rich_suggestion.dart b/lib/widgets/rich_suggestion.dart index 7c3a5b1..13bd2a3 100644 --- a/lib/widgets/rich_suggestion.dart +++ b/lib/widgets/rich_suggestion.dart @@ -24,18 +24,23 @@ class RichSuggestion extends StatelessWidget { final List result = []; final style = TextStyle(color: Colors.grey, fontSize: 15); - final startText = autoCompleteItem.text?.substring(0, autoCompleteItem.offset); + final startText = + autoCompleteItem.text?.substring(0, autoCompleteItem.offset); if (startText?.isNotEmpty == true) { result.add(TextSpan(text: startText, style: style)); } - final boldText = - autoCompleteItem.text?.substring(autoCompleteItem.offset!, autoCompleteItem.offset! + autoCompleteItem.length!); + final boldText = autoCompleteItem.text?.substring(autoCompleteItem.offset!, + autoCompleteItem.offset! + autoCompleteItem.length!); result.add( - TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.bodyText1?.color)), + TextSpan( + text: boldText, + style: style.copyWith( + color: Theme.of(context).textTheme.bodySmall?.color)), ); - final remainingText = autoCompleteItem.text?.substring(autoCompleteItem.offset! + autoCompleteItem.length!); + final remainingText = autoCompleteItem.text + ?.substring(autoCompleteItem.offset! + autoCompleteItem.length!); result.add(TextSpan(text: remainingText, style: style)); return result; diff --git a/lib/widgets/search_input.dart b/lib/widgets/search_input.dart index 299c917..1273161 100644 --- a/lib/widgets/search_input.dart +++ b/lib/widgets/search_input.dart @@ -57,11 +57,13 @@ class SearchInputState extends State { padding: EdgeInsets.symmetric(horizontal: 8), child: Row( children: [ - Icon(Icons.search, color: Theme.of(context).textTheme.bodyText1?.color), + Icon(Icons.search, + color: Theme.of(context).textTheme.bodySmall?.color), SizedBox(width: 8), Expanded( child: TextField( - decoration: InputDecoration(hintText: "Search place", border: InputBorder.none), + decoration: InputDecoration( + hintText: "Search place", border: InputBorder.none), controller: this.editController, onChanged: (value) { setState(() { diff --git a/pubspec.lock b/pubspec.lock index 56e97de..060c958 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,58 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -59,7 +66,8 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + sha256: "5c574d21b98ec92adab05ead10afd2b13ff5856c7ca79696edb338a9dd8ed387" + url: "https://pub.dev" source: hosted version: "2.0.5" flutter_test: @@ -76,126 +84,160 @@ packages: dependency: "direct main" description: name: geolocator - url: "https://pub.dartlang.org" + sha256: "672ba7193539d9092fac6c92d17692df2294c60109929ecb255cd6e52825ec4d" + url: "https://pub.dev" source: hosted version: "9.0.1" geolocator_android: dependency: transitive description: name: geolocator_android - url: "https://pub.dartlang.org" + sha256: "977d7b47150b331dad7d7c645b83e9fc52ecfd0436afb27fbf9cbee6dcd4075e" + url: "https://pub.dev" source: hosted version: "4.1.0" geolocator_apple: dependency: transitive description: name: geolocator_apple - url: "https://pub.dartlang.org" + sha256: "1b17544d250bbfebd2f36157f9ce094b0b07967441c1010243d6ea04f6f5bfe8" + url: "https://pub.dev" source: hosted version: "2.2.1" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - url: "https://pub.dartlang.org" + sha256: "8c10ba5c825abdcc337ba918fbc1d3a5a2b006affe6ba610e3143cd32f54388d" + url: "https://pub.dev" source: hosted version: "4.0.6" geolocator_web: dependency: transitive description: name: geolocator_web - url: "https://pub.dartlang.org" + sha256: f68a122da48fcfff68bbc9846bb0b74ef651afe84a1b1f6ec20939de4d6860e1 + url: "https://pub.dev" source: hosted version: "2.1.6" geolocator_windows: dependency: transitive description: name: geolocator_windows - url: "https://pub.dartlang.org" + sha256: f5911c88e23f48b598dd506c7c19eff0e001645bdc03bb6fecb9f4549208354d + url: "https://pub.dev" source: hosted version: "0.1.1" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter - url: "https://pub.dartlang.org" + sha256: "07f81e2d26a4dd2664e3beed547c75eb24b780c5c8519cd42bc0137308a1e7f6" + url: "https://pub.dev" source: hosted version: "2.2.0" google_maps_flutter_android: dependency: transitive description: name: google_maps_flutter_android - url: "https://pub.dartlang.org" + sha256: "9fd11f2ee960f8a10be95b64f261b1c3521e1d4c9f313f5547123b72ac1db507" + url: "https://pub.dev" source: hosted version: "2.1.10" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios - url: "https://pub.dartlang.org" + sha256: "71213e497600e0c67cf7a096f643e58a72ed36334456c32c7ae0a6b4698018df" + url: "https://pub.dev" source: hosted version: "2.1.11" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - url: "https://pub.dartlang.org" + sha256: "0a91acaa7ab6a438f428efe49f145a2b48f18ff039301ee2232696e18bf78784" + url: "https://pub.dev" source: hosted version: "2.2.2" http: dependency: "direct main" description: name: http - url: "https://pub.dartlang.org" + sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + url: "https://pub.dev" source: hosted version: "0.13.5" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 + url: "https://pub.dev" source: hosted version: "4.0.0" - js: + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: dependency: transitive description: - name: js - url: "https://pub.dartlang.org" + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.15.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.9.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: "075f927ebbab4262ace8d0b283929ac5410c0ac4e7fc123c76429564facfb757" + url: "https://pub.dev" source: hosted version: "2.1.2" sky_engine: @@ -207,65 +249,82 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + sha256: ed464977cb26a1f41537e177e190c67223dbd9f4f683489b6ab2e5d211ec564e + url: "https://pub.dev" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.7.2" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + url: "https://pub.dev" source: hosted version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.dev" + source: hosted + version: "14.2.5" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.10.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" From ae7b30192b362385e3f5e774096fd8a2082ab801 Mon Sep 17 00:00:00 2001 From: hasan Date: Thu, 28 Nov 2024 05:42:00 +0300 Subject: [PATCH 2/3] bug fixed --- .flutter-plugins-dependencies | 2 +- lib/widgets/place_picker.dart | 27 +++++-- lib/widgets/rich_suggestion.dart | 15 ++-- lib/widgets/search_input.dart | 2 +- pubspec.lock | 132 +++++++++++++++++++++++++------ pubspec.yaml | 9 +-- 6 files changed, 136 insertions(+), 51 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index b9a93d2..80da503 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.2.1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.1.11/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.5/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_android-4.1.0/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.1.10/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.2.1/","native_build":true,"dependencies":[]}],"linux":[],"windows":[{"name":"geolocator_windows","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_windows-0.1.1/","native_build":true,"dependencies":[]}],"web":[{"name":"geolocator_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_web-2.1.6/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geolocator","dependencies":["geolocator_android","geolocator_apple","geolocator_web","geolocator_windows"]},{"name":"geolocator_android","dependencies":[]},{"name":"geolocator_apple","dependencies":[]},{"name":"geolocator_web","dependencies":[]},{"name":"geolocator_windows","dependencies":[]},{"name":"google_maps_flutter","dependencies":["google_maps_flutter_android","google_maps_flutter_ios"]},{"name":"google_maps_flutter_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_maps_flutter_ios","dependencies":[]}],"date_created":"2024-10-11 16:08:02.089937","version":"3.24.3","swift_package_manager_enabled":false} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.7/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.6.0/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.5/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.8.0/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.7/","native_build":true,"dependencies":[]}],"linux":[],"windows":[{"name":"geolocator_windows","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/","native_build":true,"dependencies":[]}],"web":[{"name":"geolocator_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/","dependencies":[]},{"name":"google_maps_flutter_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geolocator","dependencies":["geolocator_android","geolocator_apple","geolocator_web","geolocator_windows"]},{"name":"geolocator_android","dependencies":[]},{"name":"geolocator_apple","dependencies":[]},{"name":"geolocator_web","dependencies":[]},{"name":"geolocator_windows","dependencies":[]},{"name":"google_maps_flutter","dependencies":["google_maps_flutter_android","google_maps_flutter_ios","google_maps_flutter_web"]},{"name":"google_maps_flutter_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_maps_flutter_ios","dependencies":[]},{"name":"google_maps_flutter_web","dependencies":[]}],"date_created":"2024-11-28 05:41:21.471649","version":"3.24.5","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/lib/widgets/place_picker.dart b/lib/widgets/place_picker.dart index 786330e..043c824 100644 --- a/lib/widgets/place_picker.dart +++ b/lib/widgets/place_picker.dart @@ -28,7 +28,7 @@ class PlacePicker extends StatefulWidget { /// map does not pan to the user's current location. final LatLng? displayLocation; LocalizationItem? localizationItem; - LatLng defaultLocation = LatLng(10.5381264, 73.8827201); + LatLng defaultLocation = LatLng(24.753832, 46.6925579); PlacePicker(this.apiKey, {this.displayLocation, this.localizationItem, LatLng? defaultLocation}) { @@ -90,9 +90,14 @@ class PlacePickerState extends State { super.initState(); if (widget.displayLocation == null) { _getCurrentLocation().then((value) { - setState(() { - _currentLocation = value; - }); + if (value != null) { + setState(() { + _currentLocation = value; + }); + } else { + //Navigator.of(context).pop(null); + print("getting current location null"); + } setState(() { _loadMap = true; }); @@ -132,7 +137,7 @@ class PlacePickerState extends State { locationResult = null; _delayedPop(); return Future.value(false); - } else { + } else { return Future.value(true); } }, @@ -188,8 +193,7 @@ class PlacePickerState extends State { Padding( child: Text(widget.localizationItem!.nearBy, style: TextStyle(fontSize: 16)), - padding: - EdgeInsets.symmetric(horizontal: 24, vertical: 8), + padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8), ), Expanded( child: ListView( @@ -232,6 +236,10 @@ class PlacePickerState extends State { previousSearchTerm = place; + if (context == null) { + return; + } + clearOverlay(); setState(() { @@ -506,6 +514,9 @@ class PlacePickerState extends State { var tmp = result['address_components'][i]; var types = tmp["types"] as List; var shortName = tmp['short_name']; + if (types == null) { + continue; + } if (i == 0) { // [street_number] name = shortName; @@ -634,7 +645,7 @@ class PlacePickerState extends State { //moveToLocation(target); print('target:$target'); return target; - } on TimeoutException { + } on TimeoutException catch (e) { final locationData = await Geolocator.getLastKnownPosition(); if (locationData != null) { return LatLng(locationData.latitude, locationData.longitude); diff --git a/lib/widgets/rich_suggestion.dart b/lib/widgets/rich_suggestion.dart index 13bd2a3..836ebb1 100644 --- a/lib/widgets/rich_suggestion.dart +++ b/lib/widgets/rich_suggestion.dart @@ -24,23 +24,18 @@ class RichSuggestion extends StatelessWidget { final List result = []; final style = TextStyle(color: Colors.grey, fontSize: 15); - final startText = - autoCompleteItem.text?.substring(0, autoCompleteItem.offset); + final startText = autoCompleteItem.text?.substring(0, autoCompleteItem.offset); if (startText?.isNotEmpty == true) { result.add(TextSpan(text: startText, style: style)); } - final boldText = autoCompleteItem.text?.substring(autoCompleteItem.offset!, - autoCompleteItem.offset! + autoCompleteItem.length!); + final boldText = + autoCompleteItem.text?.substring(autoCompleteItem.offset!, autoCompleteItem.offset! + autoCompleteItem.length!); result.add( - TextSpan( - text: boldText, - style: style.copyWith( - color: Theme.of(context).textTheme.bodySmall?.color)), + TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.bodyMedium?.color)), ); - final remainingText = autoCompleteItem.text - ?.substring(autoCompleteItem.offset! + autoCompleteItem.length!); + final remainingText = autoCompleteItem.text?.substring(autoCompleteItem.offset! + autoCompleteItem.length!); result.add(TextSpan(text: remainingText, style: style)); return result; diff --git a/lib/widgets/search_input.dart b/lib/widgets/search_input.dart index 1273161..0e7f6ce 100644 --- a/lib/widgets/search_input.dart +++ b/lib/widgets/search_input.dart @@ -58,7 +58,7 @@ class SearchInputState extends State { child: Row( children: [ Icon(Icons.search, - color: Theme.of(context).textTheme.bodySmall?.color), + color: Theme.of(context).textTheme.bodyMedium?.color), SizedBox(width: 8), Expanded( child: TextField( diff --git a/pubspec.lock b/pubspec.lock index 060c958..1902939 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -49,6 +49,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" fake_async: dependency: transitive description: @@ -57,6 +73,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -84,90 +108,114 @@ packages: dependency: "direct main" description: name: geolocator - sha256: "672ba7193539d9092fac6c92d17692df2294c60109929ecb255cd6e52825ec4d" + sha256: "0ec58b731776bc43097fcf751f79681b6a8f6d3bc737c94779fe9f1ad73c1a81" url: "https://pub.dev" source: hosted - version: "9.0.1" + version: "13.0.1" geolocator_android: dependency: transitive description: name: geolocator_android - sha256: "977d7b47150b331dad7d7c645b83e9fc52ecfd0436afb27fbf9cbee6dcd4075e" + sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.6.1" geolocator_apple: dependency: transitive description: name: geolocator_apple - sha256: "1b17544d250bbfebd2f36157f9ce094b0b07967441c1010243d6ea04f6f5bfe8" + sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.7" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - sha256: "8c10ba5c825abdcc337ba918fbc1d3a5a2b006affe6ba610e3143cd32f54388d" + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" url: "https://pub.dev" source: hosted - version: "4.0.6" + version: "4.2.4" geolocator_web: dependency: transitive description: name: geolocator_web - sha256: f68a122da48fcfff68bbc9846bb0b74ef651afe84a1b1f6ec20939de4d6860e1 + sha256: "2ed69328e05cd94e7eb48bb0535f5fc0c0c44d1c4fa1e9737267484d05c29b5e" url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "4.1.1" geolocator_windows: dependency: transitive description: name: geolocator_windows - sha256: f5911c88e23f48b598dd506c7c19eff0e001645bdc03bb6fecb9f4549208354d + sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" + url: "https://pub.dev" + source: hosted + version: "0.2.3" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "4d6e199c561ca06792c964fa24b2bac7197bf4b401c2e1d23e345e5f9939f531" url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "8.1.1" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter - sha256: "07f81e2d26a4dd2664e3beed547c75eb24b780c5c8519cd42bc0137308a1e7f6" + sha256: c1972cbad779bc5346c49045f26ae45550a0958b1cbca5b524dd3c8954995d28 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.6.1" google_maps_flutter_android: dependency: transitive description: name: google_maps_flutter_android - sha256: "9fd11f2ee960f8a10be95b64f261b1c3521e1d4c9f313f5547123b72ac1db507" + sha256: "0bcadb80eba39afda77dede89a6caafd3b68f2786b90491eceea4a01c3db181c" url: "https://pub.dev" source: hosted - version: "2.1.10" + version: "2.8.0" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios - sha256: "71213e497600e0c67cf7a096f643e58a72ed36334456c32c7ae0a6b4698018df" + sha256: e5132d17f051600d90d79d9f574b177c24231da702453a036db2490f9ced4646 url: "https://pub.dev" source: hosted - version: "2.1.11" + version: "2.6.0" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - sha256: "0a91acaa7ab6a438f428efe49f145a2b48f18ff039301ee2232696e18bf78784" + sha256: a951981c22d790848efb9f114f81794945bc5c06bc566238a419a92f110af6cb url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.9.5" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: ff39211bd25d7fad125d19f757eba85bd154460907cd4d135e07e3d0f98a4130 + url: "https://pub.dev" + source: hosted + version: "0.5.10" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" http: dependency: "direct main" description: name: http - sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 url: "https://pub.dev" source: hosted - version: "0.13.5" + version: "1.2.2" http_parser: dependency: transitive description: @@ -236,10 +284,18 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: "075f927ebbab4262ace8d0b283929ac5410c0ac4e7fc123c76429564facfb757" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.8" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" + source: hosted + version: "2.1.0" sky_engine: dependency: transitive description: flutter @@ -253,6 +309,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -309,6 +373,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" + url: "https://pub.dev" + source: hosted + version: "4.4.0" vector_math: dependency: transitive description: @@ -325,6 +397,14 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.5" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.19.0" diff --git a/pubspec.yaml b/pubspec.yaml index 75d6448..475e356 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,15 +4,14 @@ version: 0.10.0 homepage: https://github.com/blackmann/locationpicker environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: sdk: flutter - http: ^0.13.5 - google_maps_flutter: ^2.2.0 -# location: ^4.4.0 - geolocator: ^9.0.1 + http: ^1.2.1 + google_maps_flutter: ^2.6.1 + geolocator: ^13.0.1 dev_dependencies: flutter_test: From 140fd7a48ad8b05a6f6fc3aaa8a34d2267a6f914 Mon Sep 17 00:00:00 2001 From: hasan Date: Thu, 28 Nov 2024 05:44:33 +0300 Subject: [PATCH 3/3] bug fixed --- .flutter-plugins-dependencies | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 80da503..ff78f86 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.7/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.6.0/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.5/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.8.0/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.7/","native_build":true,"dependencies":[]}],"linux":[],"windows":[{"name":"geolocator_windows","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/","native_build":true,"dependencies":[]}],"web":[{"name":"geolocator_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/","dependencies":[]},{"name":"google_maps_flutter_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geolocator","dependencies":["geolocator_android","geolocator_apple","geolocator_web","geolocator_windows"]},{"name":"geolocator_android","dependencies":[]},{"name":"geolocator_apple","dependencies":[]},{"name":"geolocator_web","dependencies":[]},{"name":"geolocator_windows","dependencies":[]},{"name":"google_maps_flutter","dependencies":["google_maps_flutter_android","google_maps_flutter_ios","google_maps_flutter_web"]},{"name":"google_maps_flutter_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_maps_flutter_ios","dependencies":[]},{"name":"google_maps_flutter_web","dependencies":[]}],"date_created":"2024-11-28 05:41:21.471649","version":"3.24.5","swift_package_manager_enabled":false} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.7/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.6.0/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.5/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_android","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.8.0/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[{"name":"geolocator_apple","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.7/","native_build":true,"dependencies":[]}],"linux":[],"windows":[{"name":"geolocator_windows","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/","native_build":true,"dependencies":[]}],"web":[{"name":"geolocator_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/","dependencies":[]},{"name":"google_maps_flutter_web","path":"/Users/hasankaraman/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geolocator","dependencies":["geolocator_android","geolocator_apple","geolocator_web","geolocator_windows"]},{"name":"geolocator_android","dependencies":[]},{"name":"geolocator_apple","dependencies":[]},{"name":"geolocator_web","dependencies":[]},{"name":"geolocator_windows","dependencies":[]},{"name":"google_maps_flutter","dependencies":["google_maps_flutter_android","google_maps_flutter_ios","google_maps_flutter_web"]},{"name":"google_maps_flutter_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_maps_flutter_ios","dependencies":[]},{"name":"google_maps_flutter_web","dependencies":[]}],"date_created":"2024-11-28 05:44:24.788630","version":"3.24.5","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 475e356..b468d36 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - http: ^1.2.1 + http: ^1.2.2 google_maps_flutter: ^2.6.1 geolocator: ^13.0.1