//home_screen.dart
import 'package:flutter/material.dart';
import 'domicilios.dart';
import 'horarios.dart';
import 'configuracion.dart';
import 'rutas.dart';
import 'nav_bar.dart';

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  int _currentIndex = 0; // 0: Domicilios, 1: Rutas, 2: Configuración

  final List<Widget> _paginas = const [
    DomiciliosView(),
    HorariosView(),
    ConfiguracionView(),
  ];

  void _onNavBarTap(int index) {
    setState(() {
      _currentIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: _paginas[_currentIndex],
      bottomNavigationBar: CustomNavBar(
        currentIndex: _currentIndex,
        onTap: _onNavBarTap,
      ),
    );
  }
}