add google place : NOK
This commit is contained in:
@@ -3,8 +3,9 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:mapbox_place_search/mapbox_place_search.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:io';
|
||||
@@ -50,7 +51,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
TextEditingController endDatepicker = TextEditingController();
|
||||
TextEditingController endTimepicker = TextEditingController();
|
||||
|
||||
String MAPBOX_API_KEY = "";
|
||||
String GOOGLEMAP_API_KEY = "";
|
||||
|
||||
onTapFunctionDatePicker(
|
||||
{required BuildContext context, required String position}) async {
|
||||
@@ -166,7 +167,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
|
||||
void start() async {
|
||||
await dotenv.load();
|
||||
MAPBOX_API_KEY = dotenv.env['MAPBOX_API_KEY']!;
|
||||
GOOGLEMAP_API_KEY = dotenv.env['GOOGLEMAP_API_KEY']!;
|
||||
|
||||
inputName.text = widget.events["name"];
|
||||
inputPlace.text = widget.events["place"];
|
||||
@@ -219,7 +220,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
hintText: 'Modifier le nom de l\'évènement'),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
/* Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
@@ -230,20 +231,39 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
labelText: 'Lieu',
|
||||
hintText: 'Entrer le lieu'),
|
||||
),
|
||||
),
|
||||
),*/
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
child: MapBoxPlaceSearchWidget(
|
||||
popOnSelect: true,
|
||||
apiKey: MAPBOX_API_KEY,
|
||||
searchHint: widget.events["place"],
|
||||
onSelected: (place) {
|
||||
print("place : ${place.center}");
|
||||
child: GooglePlacesAutoCompleteTextFormField(
|
||||
textEditingController: inputPlace,
|
||||
googleAPIKey: GOOGLEMAP_API_KEY,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Enter your address',
|
||||
labelText: 'Lieu',
|
||||
labelStyle: TextStyle(color: Colors.purple),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter some text';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
context: context,
|
||||
//iconAssetPath: './images/search.png',
|
||||
// proxyURL: _yourProxyURL,
|
||||
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(
|
||||
|
Reference in New Issue
Block a user