home_page.dart 2.05 KB
Newer Older
1
import 'package:flutter/material.dart';
2 3
import 'package:practica1_flutter/src/pages/category/category_widget.dart'; // Asegúrate de importar la página de categorías
import 'package:practica1_flutter/src/pages/category_form.dart'; // Asegúrate de importar la página del formulario
4

5 6
class HomeSellerPage extends StatelessWidget {
  const HomeSellerPage({Key? key}) : super(key: key);
7 8 9

  @override
  Widget build(BuildContext context) {
10 11 12 13 14
    return DefaultTabController(
      length: 2,
      child: Scaffold(
        appBar: AppBar(
          title: const Text("ShopMaster"),
15
          centerTitle: true,
16 17 18 19 20 21 22
          foregroundColor: Colors.white,
          backgroundColor: Colors.indigoAccent,
          bottom: const TabBar(
            tabs: [
              Tab(icon: Icon(Icons.article_outlined), text: "Artículos"),
              Tab(icon: Icon(Icons.category), text: "Categorías"),
            ],
23
          ),
24
        ),
25 26 27 28 29 30 31 32 33 34 35 36 37
        drawer: MenuLateral(),
        body: TabBarView(
          children: [
            CategoryWidget(), // Página de categorías
          ],
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            Navigator.pushNamed(context, 'category_form');
          },
          child: Icon(Icons.add),
          tooltip: 'Agregar Categoría', // Mensaje para el botón
        ),
38 39 40
      ),
    );
  }
41
}
42 43

// Clase del menú lateral
44 45 46 47 48 49 50
class MenuLateral extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Drawer(
      child: ListView(
        children: [
          const UserAccountsDrawerHeader(
51 52
            accountName: Text("Efren David"),
            accountEmail: Text("24mdavid25@gmail.com"),
53 54
          ),
          Ink(
55
            color: Colors.indigo,
56
            child: ListTile(
57
              title: const Text("Mi cuenta", style: TextStyle(color: Colors.white)),
58 59 60
            ),
          ),
          const ListTile(
61
            title: Text("Categorías"),
62 63
          ),
          const ListTile(
64
            title: Text("Configuración"),
65 66 67 68 69 70
          ),
        ],
      ),
    );
  }
}