From 532fbac50431e97997e60a97c6e9cc339bf0bdb3 Mon Sep 17 00:00:00 2001 From: = <24mdavid25@gmail.com> Date: Wed, 31 Jul 2024 13:59:22 -0600 Subject: [PATCH] Actividad 5 home --- lib/model/categoria.dart | 0 lib/src/pages/articles_page.dart | 2 +- lib/src/pages/home_page.dart | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ lib/src/pages/login_page.dart | 51 ++++++++++++++++++++++----------------------------- pubspec.yaml | 2 -- 5 files changed, 96 insertions(+), 44 deletions(-) create mode 100644 lib/model/categoria.dart diff --git a/lib/model/categoria.dart b/lib/model/categoria.dart new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/model/categoria.dart diff --git a/lib/src/pages/articles_page.dart b/lib/src/pages/articles_page.dart index 0078148..04f028f 100644 --- a/lib/src/pages/articles_page.dart +++ b/lib/src/pages/articles_page.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; - +import 'package:practica1_flutter/src/pages/home_page.dart'; class ArticlesPage extends StatelessWidget { const ArticlesPage({Key? key}) : super(key: key); diff --git a/lib/src/pages/home_page.dart b/lib/src/pages/home_page.dart index 5fca443..5416b96 100644 --- a/lib/src/pages/home_page.dart +++ b/lib/src/pages/home_page.dart @@ -1,24 +1,85 @@ import 'package:flutter/material.dart'; +import 'package:practica1_flutter/src/pages/articles_page.dart'; class HomeSellerPage extends StatelessWidget { const HomeSellerPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - return Scaffold( - 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'), + return DefaultTabController(// Agrega un DefaultTabController para manejar el estado de las pestañas. + length: 2, // Define el número de pestañas. + child: MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Estoy en Home', + theme: ThemeData( + primaryColor: Colors.blue, + ), + home: Scaffold( + appBar: AppBar( + title: const Text("ShopMaster"), + bottom: const TabBar( // Agrega el TabBar en la parte inferior de la AppBar. + tabs: [ + Tab(icon: Icon(Icons.article_outlined), text: "Articulos"), + Tab(icon: Icon(Icons.shop_2), text: "Ventas"), + ], + ), + ), + drawer: MenuLateral(), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + /*ElevatedButton( + onPressed: () { + Navigator.pushNamed(context, 'articulos'); + }, + child: const Text('Acceder a articulos -->'), + ),*/ + const SizedBox(height: 200), + + FloatingActionButton( + onPressed: () { + }, + child: Icon(Icons.add), + tooltip: 'Agregar Categoría',//Mensaje + ), + + ], + ), + ), ), ), ); } } +//Clase del meuno lateral +class MenuLateral extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Drawer( + child: ListView( + children: [ + const UserAccountsDrawerHeader( + accountName: Text("Mi cuenta"), + accountEmail: Text("Prueba@gmail.com"), + ), + Ink( + color: Colors.indigo, // Cambiar color de cada menú. + child: ListTile( + title: const Text("Menu 1", style: TextStyle(color: Colors.white)), + ), + ), + const ListTile( + title: Text("Menu 2"), + ), + const ListTile( + title: Text("Menu 2"), + ), + ], + ), + ); + } +} + + + diff --git a/lib/src/pages/login_page.dart b/lib/src/pages/login_page.dart index ef59142..9de2584 100644 --- a/lib/src/pages/login_page.dart +++ b/lib/src/pages/login_page.dart @@ -1,62 +1,55 @@ import 'package:flutter/material.dart'; -class LoginPage extends StatefulWidget { +class LoginPage extends StatelessWidget { const LoginPage({Key? key}) : super(key: key); @override - _LoginPageState createState() => _LoginPageState(); -} - -class _LoginPageState extends State { - - @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: const Text('Iniciar sesión'), - backgroundColor: Colors.lightBlue, - actions: const [ - Icon(Icons.search), - Icon(Icons.menu), - ], + title: const Text('Estoy en Login'), + backgroundColor: Colors.lightBlue, // Agregar color en la appBar ), - body: Padding( - padding: const EdgeInsets.all(16.0), - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset('assets/img/logo_visorus.jpg'), - const SizedBox(height: 20), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset('assets/img/logo_visorus.jpg', height: 100), + const SizedBox(height: 20),//Espacio entre la imagen y campo de texto - //Campo de Usuario - TextField( + Padding( + padding: const EdgeInsets.symmetric(horizontal: 80.0), // añado mi margen horizontal + child: TextField( decoration: const InputDecoration( labelText: 'Usuario', border: OutlineInputBorder(), ), ), - const SizedBox(height: 20), + ), + const SizedBox(height: 20), - //Campo de contraseña - TextField( + Padding( + padding: const EdgeInsets.symmetric(horizontal: 80.0), // Añado mi margen horizontal + child: TextField( decoration: const InputDecoration( labelText: 'Contraseña', border: OutlineInputBorder(), ), obscureText: true, ), - const SizedBox(height: 20), + ), + const SizedBox(height: 20), + ElevatedButton( onPressed: () { Navigator.pushNamed(context, 'homeSeller'); }, child: const Text('Acceder'), ), - ], - ), + ], ), ), ); } } + diff --git a/pubspec.yaml b/pubspec.yaml index ca48cd0..bc38157 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,8 +31,6 @@ environment: dependencies: flutter: sdk: flutter - - # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 -- libgit2 0.27.1