P.S. I want to search cities. By default I used administrative_area_3 when I used Java. So here's not working anything. Tried to update from 0.0.4 to 0.0.5, but it didn't fix my problems.
import 'package:flutter_google_places_autocomplete/flutter_google_places_autocomplete.dart';
const kGoogleApiKey = "private";
GoogleMapsPlaces _places = new GoogleMapsPlaces(kGoogleApiKey);
class Backdrop extends StatefulWidget {
@override
_BackdropState createState() => _BackdropState();
}
Future<Null> displayPrediction(Prediction p, ScaffoldState scaffold) async {
if (p != null) {
// get detail (lat/lng)
PlacesDetailsResponse detail = await _places.getDetailsByPlaceId(p.placeId);
final lat = detail.result.geometry.location.lat;
final lng = detail.result.geometry.location.lng;
scaffold.showSnackBar(
new SnackBar(content: new Text("${p.description} - $lat/$lng")));
}
}
..Somewhere in state code:
IconButton(
icon: Icon(Icons.location_searching),
onPressed: () async {
Prediction p = await showGooglePlacesAutocomplete(
context: context,
apiKey: kGoogleApiKey,
onError: (res) {
homeScaffoldKey.currentState.showSnackBar(
new SnackBar(content: new Text(res.errorMessage)));
},
mode: _mode
);
displayPrediction(p, homeScaffoldKey.currentState);
},
)
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(4.00))),
contentPadding: EdgeInsets.symmetric(vertical: 12.50, horizontal: 10.00)
),
Okey, my appologies, I'm a little bit dumb. I fixed search results by deleting language and component. Yay 🤣
But anyway, thanks in advance.