This commit is contained in:
Juan Felipe Duarte
2023-06-06 17:15:49 -05:00
parent cca8c87e7c
commit ebcc95d06a
6 changed files with 128 additions and 28 deletions
+17
View File
@@ -0,0 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http;
class NetworkUtility {
static Future<String?> fetchUrl(Uri uri,
{Map<String, String>? headers}) async {
try {
final response = await http.get(uri, headers: headers);
if (response.statusCode == 200) {
return response.body;
}
} catch (e) {
debugPrint('error - ${e.toString()}');
}
return null;
}
}
+12
View File
@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
@@ -101,6 +102,17 @@ class LocalPhoto extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (kIsWeb) {
return ClipOval(
child: Image.network(
file.path,
width: photoSize,
height: photoSize,
fit: BoxFit.cover,
),
);
}
return ClipOval(
child: Image.file(
file,
+58 -6
View File
@@ -9,8 +9,10 @@ import 'package:geocoding/geocoding.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:prosappco/constansts.dart';
import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/drawer_menu.dart';
import 'package:prosappco/src/components/network_utility.dart';
import 'package:prosappco/src/models/event_model.dart';
import 'package:prosappco/src/models/user_model.dart';
import 'package:prosappco/src/screens/professional.dart';
@@ -201,6 +203,20 @@ class _ServiceScreenState extends State<ServiceScreen> {
return address;
}
void placeAutoComplete(String query) async {
Uri uri =
Uri.https("maps.googleapis.com", "maps/api/place/autocomplete/json", {
"input": query,
"key": apiKey,
});
String? response = await NetworkUtility.fetchUrl(uri);
if (response != null) {
print(response);
}
}
@override
Widget build(BuildContext context) {
if (kIsWeb) {
@@ -237,8 +253,8 @@ class _ServiceScreenState extends State<ServiceScreen> {
},
);
},
child: Row(
children: const [
child: const Row(
children: [
Icon(Icons.location_on),
SizedBox(width: 8),
Text('Ingresar mi ubicación'),
@@ -251,7 +267,27 @@ class _ServiceScreenState extends State<ServiceScreen> {
), // Texto del título
),
body: Container(
child: const Text('data'),
child: ElevatedButton(
onPressed: () {
placeAutoComplete("Dubai");
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
elevation: 0,
minimumSize: const Size(230, 50),
),
child: const Text(
'Aceptar',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
),
);
}
@@ -726,10 +762,24 @@ class _ServiceScreenState extends State<ServiceScreen> {
class _EnterLocationDialog extends StatelessWidget {
const _EnterLocationDialog({super.key});
void placeAutoComplete(String query) async {
Uri uri =
Uri.https("maps.googleapis.com", "/maps/api/place/autocomplete/json", {
"input": query,
"key": apiKey,
});
String? response = await NetworkUtility.fetchUrl(uri);
if (response != null) {
print(response);
}
}
@override
Widget build(BuildContext context) {
return AlertDialog(
content: Container(
content: SizedBox(
height: 200,
child: Column(
children: [
@@ -743,12 +793,14 @@ class _EnterLocationDialog extends StatelessWidget {
const SizedBox(height: 20),
TextFormField(
decoration: const InputDecoration(
hintText: 'Ubicación',
hintText: 'Escribe tu ubicación',
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {},
onPressed: () {
placeAutoComplete("Dubai");
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC),
shape: RoundedRectangleBorder(