This commit is contained in:
Juan Felipe Duarte
2023-06-15 16:00:15 -05:00
parent 70f160da84
commit deef3c56f4
6 changed files with 41 additions and 9 deletions
+30 -9
View File
@@ -21,6 +21,7 @@ import 'package:prosappco/src/screens/profile.dart';
import 'package:prosappco/src/screens/service_after.dart';
import 'package:prosappco/src/screens/service_type.dart';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
class ServiceScreen extends StatefulWidget {
const ServiceScreen({super.key});
@@ -204,17 +205,37 @@ class _ServiceScreenState extends State<ServiceScreen> {
}
void placeAutoComplete(String query) async {
Uri uri =
Uri.https("maps.googleapis.com", "maps/api/place/autocomplete/json", {
"input": query,
"key": apiKey,
});
String url = "https://admin.prosapp.co/autocomplete?input=$query";
String? response = await NetworkUtility.fetchUrl(uri);
Uri uri = Uri.parse(url);
if (response != null) {
print(response);
// Imprimir la URL completa
print(uri.toString());
try {
http.Response response = await http.get(uri);
if (response.statusCode == 200) {
// Imprimir la respuesta
print(response.body);
} else {
// Manejar otros códigos de estado de respuesta
print("Error: ${response.statusCode}");
}
} catch (error) {
// Manejar errores de conexión o solicitud
print("Error: $error");
}
// Uri uri = Uri.https("admin.prosapp.co", "/autocomplete", {
// "input": query,
// });
// String? response = await NetworkUtility.fetchUrl(uri);
// if (response != null) {
// print(response);
// }
}
@override
@@ -269,7 +290,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
body: Container(
child: ElevatedButton(
onPressed: () {
placeAutoComplete("Dubai");
placeAutoComplete("Colombia");
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC),
@@ -6,9 +6,13 @@
#include "generated_plugin_registrant.h"
#include <file_selector_linux/file_selector_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
+1
View File
@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
url_launcher_linux
)
@@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation
import cloud_firestore
import file_selector_macos
import firebase_auth
import firebase_core
import firebase_messaging
@@ -16,6 +17,7 @@ import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
@@ -6,11 +6,14 @@
#include "generated_plugin_registrant.h"
#include <file_selector_windows/file_selector_windows.h>
#include <firebase_core/firebase_core_plugin_c_api.h>
#include <geolocator_windows/geolocator_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
FirebaseCorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
GeolocatorWindowsRegisterWithRegistrar(
+1
View File
@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
firebase_core
geolocator_windows
url_launcher_windows