diff --git a/covas_mobile/images/search.png b/covas_mobile/images/search.png new file mode 100644 index 0000000..9454673 Binary files /dev/null and b/covas_mobile/images/search.png differ diff --git a/covas_mobile/lib/pages/UpdateEventImage.dart b/covas_mobile/lib/pages/UpdateEventImage.dart index 0523aaa..f7ff85a 100644 --- a/covas_mobile/lib/pages/UpdateEventImage.dart +++ b/covas_mobile/lib/pages/UpdateEventImage.dart @@ -3,6 +3,8 @@ 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 'dart:convert'; import 'dart:io'; @@ -48,6 +50,8 @@ class _UpdateeventImageState extends State TextEditingController endDatepicker = TextEditingController(); TextEditingController endTimepicker = TextEditingController(); + String MAPBOX_API_KEY = ""; + onTapFunctionDatePicker( {required BuildContext context, required String position}) async { DateTime? pickedDate = await showDatePicker( @@ -161,6 +165,9 @@ class _UpdateeventImageState extends State } void start() async { + await dotenv.load(); + MAPBOX_API_KEY = dotenv.env['MAPBOX_API_KEY']!; + inputName.text = widget.events["name"]; inputPlace.text = widget.events["place"]; print("date start : ${widget.events["date"]}"); @@ -224,6 +231,21 @@ class _UpdateeventImageState extends State 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}"); + }, + context: context, + //iconAssetPath: './images/search.png', + ), + ), Padding( padding: const EdgeInsets.only( left: 15.0, right: 15.0, top: 15, bottom: 0), diff --git a/covas_mobile/pubspec.lock b/covas_mobile/pubspec.lock index 0527810..d95e826 100644 --- a/covas_mobile/pubspec.lock +++ b/covas_mobile/pubspec.lock @@ -81,6 +81,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + color: + dependency: transitive + description: + name: color + sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb + url: "https://pub.dev" + source: hosted + version: "3.0.0" cross_file: dependency: transitive description: @@ -89,6 +97,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.4+2" + crypto: + dependency: transitive + description: + name: crypto + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 + url: "https://pub.dev" + source: hosted + version: "3.0.5" cupertino_icons: dependency: "direct main" description: @@ -177,6 +193,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.9.3+2" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -360,6 +384,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + mapbox_place_search: + dependency: "direct main" + description: + name: mapbox_place_search + sha256: "36e213d66e38c3494321177a80b65f6b420068e54eaf9978cb312da97e4af250" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + mapbox_search: + dependency: "direct main" + description: + name: mapbox_search + sha256: "6606ab1af8f34a22b5b096d6037d95117e4b51d48c63161d817130c91c736e7e" + url: "https://pub.dev" + source: hosted + version: "4.2.2" matcher: dependency: transitive description: @@ -533,6 +573,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -589,6 +637,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90" + url: "https://pub.dev" + source: hosted + version: "4.4.2" vector_math: dependency: transitive description: diff --git a/covas_mobile/pubspec.yaml b/covas_mobile/pubspec.yaml index 1bc13d8..0119c6f 100644 --- a/covas_mobile/pubspec.yaml +++ b/covas_mobile/pubspec.yaml @@ -45,6 +45,8 @@ dependencies: flutter_dotenv: ^5.1.0 image_picker: ^1.1.2 date_format_field: ^0.1.0 + mapbox_search: ^4.2.2 + mapbox_place_search: ^1.0.2 dev_dependencies: flutter_test: @@ -72,6 +74,7 @@ flutter: assets: - images/flutter.png - .env + - images/search.png # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see