matanshukry / flutter_google_places_sdk

Flutter plugin for google places native sdk
32 stars 68 forks source link

AutocompletionRequest is missing a few params #5

Closed nullrocket closed 2 years ago

nullrocket commented 2 years ago

AutocompletionRequest is missing a few params, I added them in because I needed to restrict the search. I also modified findPlaces to pass these params down to the AutocompletionRequest.

I would do a pull request but I have no idea if it is the right way to fix the problem, I just know it works :).

@JS('google.maps.places')
library places;

import 'package:js/js.dart';

/// google.maps.places.AutocompletionRequest interface
///
/// Ref: https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest
@JS()
@anonymous
class AutocompletionRequest {
  /// Create an AutocompletionRequest

  // added in types and componentRestrictions params
  external factory AutocompletionRequest({String input,List<String> types, ComponentRestrictions componentRestrictions});

  /// The user entered input string.
  external String get input;
 // I added these
  external List<String> get types;
  external ComponentRestrictions get componentRestrictions;
}

// Added component restrictions class.
@JS()
@anonymous
class ComponentRestrictions {
  external factory ComponentRestrictions();
  external Object get country;
  external  void set country(Object country);

}
matanshukry commented 2 years ago

@nullrocket So for your needs (web) you should be good to go.

Missing:

matanshukry commented 2 years ago

Implemented typeFilter in iOS.