Procházet zdrojové kódy

Union Sprint 3 Carlos

Oniel Mendez před 4 roky
rodič
revize
0876c368c6

+ 27
- 1
fast_med_flutter/lib/routes/ver_oficina.dart Zobrazit soubor

@@ -5,6 +5,9 @@ import '../widgets/DataTableMySqlDemo/Especialista.dart';
5 5
 import '../widgets/DataTableMySqlDemo/Services.dart';
6 6
 import 'dart:async';
7 7
 import '../widgets/functions.dart';
8
+import 'package:flutter/material.dart';
9
+import 'package:url_launcher/url_launcher.dart';
10
+
8 11
 
9 12
 class VerOficina extends StatefulWidget{
10 13
   VerOficina() : super();
@@ -238,7 +241,30 @@ class _VerOficinaState extends State<VerOficina>{
238 241
                     children: <Widget>[
239 242
                       TextButton(
240 243
                         child: const Text('Buscar en el mapa'),
241
-                        onPressed: () { /* ... */ },
244
+                        onPressed: () {
245
+                          setState(() async {
246
+                            String destinationLatitude = "18.39007092764153";
247
+                            String destinationLongitude = "-65.976216841223";
248
+                            String originlatitude = "18.418738017376207";
249
+                            String originlongitude = "-66.02565531285634";
250
+
251
+                            //const url = 'https://www.google.com/maps/@42.585444,13.007813,6z';
252
+                            const url = "https://www.google.com/maps/dir/?api=1&parameters&origin=18.418738017376207,-66.02565531285634&destination=18.39007092764153,-65.976216841223";
253
+                            if (await canLaunch(url)) {
254
+                              await launch(url);
255
+                            } else {
256
+                              throw 'Could not launch $url';
257
+                            }
258
+
259
+                            //String uri = "http://maps.google.com/maps?daddr=" + destinationLatitude + "," + destinationLongitude + " (" + "Doctor" + ")";
260
+                            //Intent intent;
261
+                            //intent.setAction(Action.ACTION_VIEW);
262
+                            //Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
263
+                            //intent.setPackage("com.google.android.apps.maps");
264
+                            //startActivity(intent);
265
+                            //UIApplication.shared.openURL(URL(string:"https://www.google.com/maps/@42.585444,13.007813,6z")!);
266
+                          });
267
+                          },
242 268
                       ),
243 269
                       const SizedBox(width: 8),
244 270
                     ],

+ 43
- 1
fast_med_flutter/pubspec.lock Zobrazit soubor

@@ -399,6 +399,48 @@ packages:
399 399
       url: "https://pub.dartlang.org"
400 400
     source: hosted
401 401
     version: "1.3.0-nullsafety.3"
402
+  url_launcher:
403
+    dependency: "direct main"
404
+    description:
405
+      name: url_launcher
406
+      url: "https://pub.dartlang.org"
407
+    source: hosted
408
+    version: "5.7.10"
409
+  url_launcher_linux:
410
+    dependency: transitive
411
+    description:
412
+      name: url_launcher_linux
413
+      url: "https://pub.dartlang.org"
414
+    source: hosted
415
+    version: "0.0.1+4"
416
+  url_launcher_macos:
417
+    dependency: transitive
418
+    description:
419
+      name: url_launcher_macos
420
+      url: "https://pub.dartlang.org"
421
+    source: hosted
422
+    version: "0.0.1+9"
423
+  url_launcher_platform_interface:
424
+    dependency: transitive
425
+    description:
426
+      name: url_launcher_platform_interface
427
+      url: "https://pub.dartlang.org"
428
+    source: hosted
429
+    version: "1.0.9"
430
+  url_launcher_web:
431
+    dependency: transitive
432
+    description:
433
+      name: url_launcher_web
434
+      url: "https://pub.dartlang.org"
435
+    source: hosted
436
+    version: "0.1.5+1"
437
+  url_launcher_windows:
438
+    dependency: transitive
439
+    description:
440
+      name: url_launcher_windows
441
+      url: "https://pub.dartlang.org"
442
+    source: hosted
443
+    version: "0.0.1+3"
402 444
   vector_math:
403 445
     dependency: transitive
404 446
     description:
@@ -422,4 +464,4 @@ packages:
422 464
     version: "0.1.2"
423 465
 sdks:
424 466
   dart: ">=2.10.0-110 <2.11.0"
425
-  flutter: ">=1.17.0 <2.0.0"
467
+  flutter: ">=1.22.0 <2.0.0"

+ 1
- 0
fast_med_flutter/pubspec.yaml Zobrazit soubor

@@ -23,6 +23,7 @@ environment:
23 23
 dependencies:
24 24
   flutter:
25 25
     sdk: flutter
26
+  url_launcher: ^5.4.0
26 27
 
27 28
   firebase_helpers: ^0.1.8
28 29
   cloud_firestore: ^0.13.5