From 5601bccba1cc13fff8f36e1958d2de0b56155f24 Mon Sep 17 00:00:00 2001 From: Angel David Carlos Silva Date: Fri, 26 Apr 2024 10:31:16 -0600 Subject: [PATCH] Dio para registro --- .../lib/config/dio.dart | 16 +++++++++++++ .../lib/pages/register.dart | 8 +++++++ .../aplicacionrutasturisticas/pubspec.lock | 24 +++++++++++++++++++ .../aplicacionrutasturisticas/pubspec.yaml | 1 + 4 files changed, 49 insertions(+) create mode 100644 fronted/aplicacionrutasturisticas/lib/config/dio.dart diff --git a/fronted/aplicacionrutasturisticas/lib/config/dio.dart b/fronted/aplicacionrutasturisticas/lib/config/dio.dart new file mode 100644 index 0000000..6b9ecbe --- /dev/null +++ b/fronted/aplicacionrutasturisticas/lib/config/dio.dart @@ -0,0 +1,16 @@ +import 'package:dio/dio.dart'; + +final dio = Dio(); +void Registro_Datos(String nombre, String lastname, String email, int phone, + String password) async { + Response response; + response = await dio.post("http://localhost:3306", data: { + 'name': nombre, + 'lastname': lastname, + 'email': email, + 'phone': phone, + 'password': password + }); + print("Hola\n"); + print(response.data.toString()); +} diff --git a/fronted/aplicacionrutasturisticas/lib/pages/register.dart b/fronted/aplicacionrutasturisticas/lib/pages/register.dart index b7e35ca..9aa7ea2 100644 --- a/fronted/aplicacionrutasturisticas/lib/pages/register.dart +++ b/fronted/aplicacionrutasturisticas/lib/pages/register.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:aplicacionrutasturisticas/config/dio.dart'; import 'package:aplicacionrutasturisticas/utilerias/Buttons.dart'; import 'package:aplicacionrutasturisticas/utilerias/Textfields.dart'; import 'package:flutter/cupertino.dart'; @@ -108,6 +109,7 @@ class RegistroPageState extends State { } void precionaRegistro() { + int phoneInt = int.parse(pho); nom = nombre.text; ape = apellido.text; ema = email.text; @@ -128,5 +130,11 @@ class RegistroPageState extends State { ' ' + passc + " \n "); + + if (pass == passc) { + Registro_Datos(nom, ape, ema, phoneInt, pass); + } else { + print("La contraseƱa es incorrecta"); + } } } diff --git a/fronted/aplicacionrutasturisticas/pubspec.lock b/fronted/aplicacionrutasturisticas/pubspec.lock index 57599ee..894899e 100644 --- a/fronted/aplicacionrutasturisticas/pubspec.lock +++ b/fronted/aplicacionrutasturisticas/pubspec.lock @@ -49,6 +49,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.6" + dio: + dependency: "direct main" + description: + name: dio + sha256: "11e40df547d418cc0c4900a9318b26304e665da6fa4755399a9ff9efd09034b5" + url: "https://pub.dev" + source: hosted + version: "5.4.3+1" fake_async: dependency: transitive description: @@ -88,6 +96,14 @@ packages: url: "https://pub.dev" source: hosted version: "13.2.4" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" leak_tracker: dependency: transitive description: @@ -213,6 +229,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" vector_math: dependency: transitive description: diff --git a/fronted/aplicacionrutasturisticas/pubspec.yaml b/fronted/aplicacionrutasturisticas/pubspec.yaml index 3cfaa64..a66ab6a 100644 --- a/fronted/aplicacionrutasturisticas/pubspec.yaml +++ b/fronted/aplicacionrutasturisticas/pubspec.yaml @@ -36,6 +36,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 go_router: ^13.2.4 + dio: ^5.4.3+1 dev_dependencies: flutter_test: -- GitLab