add google place : NOK
This commit is contained in:
parent
af673b1abd
commit
0c2ab76cc9
@ -3,8 +3,9 @@ import 'package:flutter/widgets.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:mapbox_place_search/mapbox_place_search.dart';
|
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:google_places_autocomplete_text_field/google_places_autocomplete_text_field.dart';
|
||||||
|
import 'package:google_places_autocomplete_text_field/model/prediction.dart';
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
@ -50,7 +51,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
TextEditingController endDatepicker = TextEditingController();
|
TextEditingController endDatepicker = TextEditingController();
|
||||||
TextEditingController endTimepicker = TextEditingController();
|
TextEditingController endTimepicker = TextEditingController();
|
||||||
|
|
||||||
String MAPBOX_API_KEY = "";
|
String GOOGLEMAP_API_KEY = "";
|
||||||
|
|
||||||
onTapFunctionDatePicker(
|
onTapFunctionDatePicker(
|
||||||
{required BuildContext context, required String position}) async {
|
{required BuildContext context, required String position}) async {
|
||||||
@ -166,7 +167,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
|
|
||||||
void start() async {
|
void start() async {
|
||||||
await dotenv.load();
|
await dotenv.load();
|
||||||
MAPBOX_API_KEY = dotenv.env['MAPBOX_API_KEY']!;
|
GOOGLEMAP_API_KEY = dotenv.env['GOOGLEMAP_API_KEY']!;
|
||||||
|
|
||||||
inputName.text = widget.events["name"];
|
inputName.text = widget.events["name"];
|
||||||
inputPlace.text = widget.events["place"];
|
inputPlace.text = widget.events["place"];
|
||||||
@ -219,7 +220,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
hintText: 'Modifier le nom de l\'évènement'),
|
hintText: 'Modifier le nom de l\'évènement'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
/* Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
@ -230,20 +231,39 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
labelText: 'Lieu',
|
labelText: 'Lieu',
|
||||||
hintText: 'Entrer le lieu'),
|
hintText: 'Entrer le lieu'),
|
||||||
),
|
),
|
||||||
),
|
),*/
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: MapBoxPlaceSearchWidget(
|
child: GooglePlacesAutoCompleteTextFormField(
|
||||||
popOnSelect: true,
|
textEditingController: inputPlace,
|
||||||
apiKey: MAPBOX_API_KEY,
|
googleAPIKey: GOOGLEMAP_API_KEY,
|
||||||
searchHint: widget.events["place"],
|
decoration: const InputDecoration(
|
||||||
onSelected: (place) {
|
hintText: 'Enter your address',
|
||||||
print("place : ${place.center}");
|
labelText: 'Lieu',
|
||||||
|
labelStyle: TextStyle(color: Colors.purple),
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Please enter some text';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
context: context,
|
// proxyURL: _yourProxyURL,
|
||||||
//iconAssetPath: './images/search.png',
|
maxLines: 1,
|
||||||
|
overlayContainer: (child) => Material(
|
||||||
|
elevation: 1.0,
|
||||||
|
color: Colors.green,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
getPlaceDetailWithLatLng: (prediction) {
|
||||||
|
print('placeDetails${prediction.lng}');
|
||||||
|
},
|
||||||
|
itmClick: (Prediction prediction) =>
|
||||||
|
inputPlace.text = prediction.description!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -256,6 +256,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.4"
|
version: "2.4.4"
|
||||||
|
google_places_autocomplete_text_field:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: google_places_autocomplete_text_field
|
||||||
|
sha256: "86615529ffdef8901d6c4f9b23f2526884dcb69d28e411beceb8093f5a23911c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
http:
|
http:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -504,6 +512,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
|
rxdart:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: rxdart
|
||||||
|
sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.27.7"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -47,6 +47,7 @@ dependencies:
|
|||||||
date_format_field: ^0.1.0
|
date_format_field: ^0.1.0
|
||||||
mapbox_search: ^4.2.2
|
mapbox_search: ^4.2.2
|
||||||
mapbox_place_search: ^1.0.2
|
mapbox_place_search: ^1.0.2
|
||||||
|
google_places_autocomplete_text_field: ^0.1.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user