YourLocation and some persist work

This commit is contained in:
vjrj 2018-06-27 08:22:00 +02:00
parent 6488957148
commit c9941429f0
13 changed files with 240 additions and 85 deletions

View file

@ -1,11 +1,13 @@
import 'package:flutter_google_places_autocomplete/flutter_google_places_autocomplete.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'basicLocation.dart';
import 'globals.dart' as globals;
import 'generated/i18n.dart';
Future<BasicLocation> openPlacesDialog(GlobalKey<ScaffoldState> sc) async {
import 'package:flutter/material.dart';
import 'package:flutter_google_places_autocomplete/flutter_google_places_autocomplete.dart';
import 'yourLocation.dart';
import 'generated/i18n.dart';
import 'globals.dart' as globals;
Future<YourLocation> openPlacesDialog(GlobalKey<ScaffoldState> sc) async {
Mode _mode = Mode.overlay;
GoogleMapsPlaces _places = new GoogleMapsPlaces(globals.gmapKey);
Prediction p = await showGooglePlacesAutocomplete(
@ -13,8 +15,8 @@ Future<BasicLocation> openPlacesDialog(GlobalKey<ScaffoldState> sc) async {
hint: S.of(sc.currentContext).typeTheNameOfAPlace,
apiKey: globals.gmapKey,
onError: (res) {
/* sc.currentState.showSnackBar(
new SnackBar(content: new Text(res.errorMessage))); */
sc.currentState
.showSnackBar(new SnackBar(content: new Text(res.errorMessage)));
print('Error $res');
},
mode: _mode,
@ -28,7 +30,7 @@ Future<BasicLocation> openPlacesDialog(GlobalKey<ScaffoldState> sc) async {
PlacesDetailsResponse detail = await _places.getDetailsByPlaceId(p.placeId);
final lat = detail.result.geometry.location.lat;
final lng = detail.result.geometry.location.lng;
return new BasicLocation(lat: lat, lon: lng, description: p.description);
return new YourLocation(lat: lat, lon: lng, description: p.description);
}
return BasicLocation.noLocation;
return YourLocation.noLocation;
}