From 24fadfa688a9949545a8b3a6549dceae4505fbb1 Mon Sep 17 00:00:00 2001 From: = <24mdavid25@gmail.com> Date: Wed, 31 Jul 2024 10:32:54 -0600 Subject: [PATCH] Subiendo actividades --- assets/img/logo_visorus.jpg | Bin 0 -> 4445 bytes lib/main.dart | 33 ++++++++++++++++----------------- lib/src/config/routes.dart | 15 ++++++++++----- lib/src/pages/articles_page.dart | 29 +++++++++++++++-------------- lib/src/pages/home_page.dart | 52 +++++++++++++++------------------------------------- lib/src/pages/login_page.dart | 59 +++++++++++++++++++++++++---------------------------------- pubspec.yaml | 4 +++- 7 files changed, 84 insertions(+), 108 deletions(-) create mode 100644 assets/img/logo_visorus.jpg diff --git a/assets/img/logo_visorus.jpg b/assets/img/logo_visorus.jpg new file mode 100644 index 0000000..9318090 Binary files /dev/null and b/assets/img/logo_visorus.jpg differ diff --git a/lib/main.dart b/lib/main.dart index 4da1031..5a1dd86 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:practica1_flutter/src/config/routes.dart'; +import 'package:practica1_flutter/src/config/routes.dart'; // Importa el archivo de rutas void main() { runApp(const MyApp()); @@ -13,34 +15,31 @@ class MyApp extends StatelessWidget { debugShowCheckedModeBanner: false, title: 'Flutter Demo', theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), - home: myWidget(), + //home: myWidget() : Se quita la propiedad home para permitir la navegación basada en rutas + initialRoute: 'login', // se define la ruta inicial + routes: getApplicationRoutes(), // Se usa las rutas definidas en routes.dart y se quito el myWidget ); } } -class myWidget extends StatelessWidget { - const myWidget({super.key}); +class MyWidget extends StatelessWidget { + const MyWidget({super.key}); @override Widget build(BuildContext context) { return Scaffold( - //child: Text("Hola mundo") - appBar: AppBar( //Barra que se encuentra en la parte superior - title: Text("Prueba AppBarsss"),//Agregar titulo en appBar - backgroundColor: Colors.lightBlue,//Agregar color en la appBar - actions: const [//Agregar iconos - Icon(Icons.search), - Icon(Icons.menu) - ], - ), - body: Column(children: []),//Va a tener varios hijos - - + appBar: AppBar( // Barra que se encuentra en la parte superior + title: Text("Prueba flutter estamo en el main "), // Agregar titulo en appBar + backgroundColor: Colors.lightBlue, // Agregar color en la appBar + actions: const [ // Agregar iconos + Icon(Icons.search), + Icon(Icons.menu) + ], + ), + body: Column(children: []), // Va a tener varios hijos ); - } } diff --git a/lib/src/config/routes.dart b/lib/src/config/routes.dart index dd2d3c1..e1986b5 100644 --- a/lib/src/config/routes.dart +++ b/lib/src/config/routes.dart @@ -1,8 +1,13 @@ -import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:practica1_flutter/src/config/routes.dart'; +import '../pages/home_page.dart'; +import '../pages/login_page.dart'; +import '../pages/articles_page.dart'; -Map getApplicationRoutes(){ +Map getApplicationRoutes() { return { - 'login': (context)=>const LoginPage(), - 'homeSeller': (context)=> const HomeSellerPage(), + 'login': (BuildContext context) => const LoginPage(), + 'homeSeller': (BuildContext context) => const HomeSellerPage(), + 'articulos': (BuildContext context) => const ArticlesPage(), }; -} \ No newline at end of file +} diff --git a/lib/src/pages/articles_page.dart b/lib/src/pages/articles_page.dart index dce1811..0078148 100644 --- a/lib/src/pages/articles_page.dart +++ b/lib/src/pages/articles_page.dart @@ -1,22 +1,23 @@ import 'package:flutter/material.dart'; -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({super.key}); +class ArticlesPage extends StatelessWidget { + const ArticlesPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - return MaterialApp( - debugShowCheckedModeBanner: false, - title: 'hola articles page ', - theme: ThemeData( - - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - useMaterial3: true, + return Scaffold( + appBar: AppBar( + title: Text('Estoy en Articulos'), + backgroundColor: Colors.red, + actions:[ + Center( + child: const Icon(Icons.shop), + ) + ], + ), + body: Center( + child: Text('Bienvenido a los articulos'), ), ); } -} \ No newline at end of file +} diff --git a/lib/src/pages/home_page.dart b/lib/src/pages/home_page.dart index b46eeca..5fca443 100644 --- a/lib/src/pages/home_page.dart +++ b/lib/src/pages/home_page.dart @@ -1,46 +1,24 @@ import 'package:flutter/material.dart'; -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - @override - Widget build(BuildContext context) { - return MaterialApp( - debugShowCheckedModeBanner: false, - title: 'Flutter Demo', - theme: ThemeData( - - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - useMaterial3: true, - ), - home: myWidget(), - ); - } -} - -class myWidget extends StatelessWidget { - const myWidget({super.key}); +class HomeSellerPage extends StatelessWidget { + const HomeSellerPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( - //child: Text("Hola mundo") - appBar: AppBar( //Barra que se encuentra en la parte superior - title: Text("hola mundo home page "),//Agregar titulo en appBar - backgroundColor: Colors.lightBlue,//Agregar color en la appBar - actions: const [//Agregar iconos - Icon(Icons.search), - Icon(Icons.menu) - ], + appBar: AppBar( + title: Text('Estoy en Home'), + backgroundColor: Colors.green, + ), + body: Center( + child: ElevatedButton( + onPressed: () { + // Navega a la página 'homePage' cuando se presiona el botón. + Navigator.pushNamed(context, 'articulos'); + }, + child: Text('Avanzar a Articulos'), + ), ), - body: Column(children: []),//Va a tener varios hijos - - ); - } -} \ No newline at end of file +} diff --git a/lib/src/pages/login_page.dart b/lib/src/pages/login_page.dart index 976c207..de54fb5 100644 --- a/lib/src/pages/login_page.dart +++ b/lib/src/pages/login_page.dart @@ -1,46 +1,37 @@ import 'package:flutter/material.dart'; -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - @override - Widget build(BuildContext context) { - return MaterialApp( - debugShowCheckedModeBanner: false, - title: 'Flutter Demo', - theme: ThemeData( - - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - useMaterial3: true, - ), - home: myWidget(), - ); - } -} - -class myWidget extends StatelessWidget { - const myWidget({super.key}); +class LoginPage extends StatelessWidget { + const LoginPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( - //child: Text("Hola mundo") - appBar: AppBar( //Barra que se encuentra en la parte superior - title: Text("Hola mundo login page"),//Agregar titulo en appBar - backgroundColor: Colors.lightBlue,//Agregar color en la appBar - actions: const [//Agregar iconos + appBar: AppBar( + title: const Text('Estoy en Login'), + backgroundColor: Colors.lightBlue, // Agregar color en la appBar + actions: const [ // Agregar iconos Icon(Icons.search), - Icon(Icons.menu) + Icon(Icons.menu), ], ), - body: Column(children: []),//Va a tener varios hijos - + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Agrega la imagen local + Image.asset('assets/img/logo_visorus.jpg',height: 100), + // Botón para navegar a la página 'homeSeller' + ElevatedButton( + onPressed: () { + // Navega a la página 'homeSeller' cuando se presiona el botón. + Navigator.pushNamed(context, 'homeSeller'); + }, + child: const Text('Avanzar a Home'), + ), + ], + ), + ), ); - } -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index 6dbb952..ca48cd0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,5 @@ name: practica1_flutter + description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. @@ -57,7 +58,8 @@ flutter: # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true - + assets: + - assets/img/ # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg -- libgit2 0.27.1