From b3bc340fc4b276e712d840855bf3f42cfc87cd52 Mon Sep 17 00:00:00 2001 From: nayeli92433 Date: Wed, 31 Jul 2024 12:35:47 -0600 Subject: [PATCH] UI home --- lib/main.dart | 4 ++-- lib/src/pages/home_page.dart | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 93 insertions(+), 14 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index d2bcaa6..1b404bd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,8 +13,8 @@ class MyApp extends StatelessWidget { return MaterialApp( title: 'Flutter Demo', debugShowCheckedModeBanner: false, - initialRoute: 'login', // Ruta inicial - routes: getApplicationRoutes(), // Definición de rutas + initialRoute: 'login', + routes: getApplicationRoutes(), ); } } diff --git a/lib/src/pages/home_page.dart b/lib/src/pages/home_page.dart index 827c232..fa4152f 100644 --- a/lib/src/pages/home_page.dart +++ b/lib/src/pages/home_page.dart @@ -1,20 +1,99 @@ import 'package:flutter/material.dart'; -class HomePage extends StatelessWidget { - const HomePage({Key? key}) : super(key: key); +void main() => runApp(const DrawerApp()); + +class DrawerApp extends StatelessWidget { + const DrawerApp({super.key}); @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('Home Page'), - ), - body: Center( - child: ElevatedButton( - onPressed: () { - Navigator.pushNamed(context, 'articles'); - }, - child: const Text('Hola home_page'), + return MaterialApp( + theme: ThemeData(useMaterial3: true), + home: const HomePage(), + ); + } +} + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + String selectedPage = ''; + + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 2, // Número de pestañas + child: Scaffold( + appBar: AppBar( + title: const Text('Home Page'), + backgroundColor: Colors.blue, + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: const Icon(Icons.menu), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ); + }, + ), + bottom: const TabBar( + tabs: [ + Tab(icon: Icon(Icons.home), text: 'Categoria'), + Tab(icon: Icon(Icons.person_2_outlined), text: 'Perfil'), + ], + ), + ), + drawer: Drawer( + child: ListView( + padding: EdgeInsets.zero, + children: [ + const DrawerHeader( + decoration: BoxDecoration( + color: Colors.blue, + ), + child: Text( + 'Menu App', + style: TextStyle( + color: Colors.white, + fontSize: 24, + ), + ), + ), + ListTile( + leading: const Icon(Icons.message), + title: const Text('Mensajes'), + onTap: () { + setState(() { + selectedPage = 'Messages'; + }); + Navigator.pop(context); // Close the drawer + }, + ), + + ListTile( + leading: const Icon(Icons.settings), + title: const Text('Configuraciones'), + onTap: () { + setState(() { + selectedPage = 'Settings'; + }); + Navigator.pop(context); // Close the drawer + }, + ), + ], + ), + ), + body: TabBarView( + children: [ + Center(child: Text('Tab 1 Contenido')), + Center(child: Text('Tab 2 Contenido')), + ], ), ), ); -- libgit2 0.27.1