import 'package:flutter/material.dart'; void main() => runApp(const DrawerApp()); class DrawerApp extends StatelessWidget { const DrawerApp({super.key}); @override Widget build(BuildContext context) { 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')), ], ), ), ); } }