import 'package:flutter/material.dart';
import 'package:lgcc/pages/home.dart';
import 'package:lgcc/pages/items_list.dart';

class MainNavigationBar extends StatefulWidget {
  @override _MainNavigationBarState createState() => _MainNavigationBarState();
}

class _MainNavigationBarState extends State<MainNavigationBar> {
  int _currentIndex =0;

  final List<Widget> _pages = [
    HomePage(),
    ItemsList(type: 'conferencias'),
    ItemsList(type: 'actividades'),
  ];

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: IndexedStack(
        index: _currentIndex,
        children: _pages,
      ),
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: _onTabTapped,
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: 'Inicio',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            label: 'Conferencias',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            label: 'Publicaciones',
          ),
        ],
      ),
    );
  }
}