From fe3a502570ad201592dcac8d08d04ec2d1db971c Mon Sep 17 00:00:00 2001 From: Angel David Carlos Silva Date: Tue, 30 Apr 2024 11:04:54 -0600 Subject: [PATCH] Navegacion rutas --- .../aplicacionrutasturisticas/lib/config/dio.dart | 4 ++-- .../lib/config/router.dart | 2 +- fronted/aplicacionrutasturisticas/lib/main.dart | 13 ++----------- .../aplicacionrutasturisticas/lib/pages/login.dart | 14 +++++++++++++- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/fronted/aplicacionrutasturisticas/lib/config/dio.dart b/fronted/aplicacionrutasturisticas/lib/config/dio.dart index a583352..1d44319 100644 --- a/fronted/aplicacionrutasturisticas/lib/config/dio.dart +++ b/fronted/aplicacionrutasturisticas/lib/config/dio.dart @@ -5,13 +5,13 @@ void Registro_Datos(String nombre, String lastname, String email, String phone, String password) async { Response response; //response = await dio.get("http://172.26.128.1:3000") - response = await dio.post("http://10.2.81.72:3000/auth-user/register", data: { + response = + await dio.post("http://172.31.128.1:3000/auth-user/register", data: { "name": nombre, "lastname": lastname, "password": password, "email": email, "phone": phone, - }); print(response.data.toString()); } diff --git a/fronted/aplicacionrutasturisticas/lib/config/router.dart b/fronted/aplicacionrutasturisticas/lib/config/router.dart index 67485c3..d4e435c 100644 --- a/fronted/aplicacionrutasturisticas/lib/config/router.dart +++ b/fronted/aplicacionrutasturisticas/lib/config/router.dart @@ -13,7 +13,7 @@ final GoRouter router = GoRouter(routes: [ routes: [ GoRoute( name: "RegisterPage", - path: "/registerlogin", + path: "registerlogin", builder: (BuildContext context, GoRouterState state) { return const RegistroPage(); }) diff --git a/fronted/aplicacionrutasturisticas/lib/main.dart b/fronted/aplicacionrutasturisticas/lib/main.dart index 0987623..066ade6 100644 --- a/fronted/aplicacionrutasturisticas/lib/main.dart +++ b/fronted/aplicacionrutasturisticas/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:aplicacionrutasturisticas/config/router.dart'; import 'package:flutter/material.dart'; import 'package:aplicacionrutasturisticas/pages/login.dart'; import 'package:aplicacionrutasturisticas/pages/register.dart'; @@ -9,16 +10,6 @@ void main() { class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return MaterialApp( - debugShowCheckedModeBanner: false, - theme: ThemeData( - primarySwatch: Colors.indigo, - visualDensity: VisualDensity.adaptivePlatformDensity, - ), - initialRoute: RegistroPage.id, - routes: { - RegistroPage.id: (_) => const RegistroPage(), - }, - ); + return MaterialApp.router(routerConfig: router); } } diff --git a/fronted/aplicacionrutasturisticas/lib/pages/login.dart b/fronted/aplicacionrutasturisticas/lib/pages/login.dart index e19a4c2..2df5bed 100644 --- a/fronted/aplicacionrutasturisticas/lib/pages/login.dart +++ b/fronted/aplicacionrutasturisticas/lib/pages/login.dart @@ -1,7 +1,9 @@ +import 'package:aplicacionrutasturisticas/utilerias/TextButtons.dart'; import 'package:flutter/material.dart'; import 'package:aplicacionrutasturisticas/utilerias/Buttons.dart'; import 'package:aplicacionrutasturisticas/utilerias/Textfields.dart'; +import 'package:go_router/go_router.dart'; class TextFielEjemploLogin extends StatefulWidget { const TextFielEjemploLogin({super.key}); @@ -57,7 +59,13 @@ class _TextFielEjemploState extends State { child: boton_Escribir( texto: "Iniciar sesiĆ³n", onPression: botonIniciaSesion, - )) + )), + SizedBox(height: 20), + ColoredBox( + color: Colors.white, + child: HacerTextButtons( + texto: "Registrarte", onPression: botonRegistrar), + ) ], ), ), @@ -71,4 +79,8 @@ class _TextFielEjemploState extends State { pass = password.text; print(corr + " " + pass); } + + void botonRegistrar() { + context.goNamed("RegisterPage"); + } } -- GitLab