//import 'package:equinox/equinox.dart';
import 'package:flutter/material.dart';
import 'package:{{ name }}/components/NavigationDot.dart';

import 'package:{{ name }}/models/User.dart';

import 'package:{{ name }}/views/Welcome.dart';
import 'package:{{ name }}/views/Notifications.dart';

class HomePage extends StatefulWidget {
  final User currentUser;

  const HomePage({@required this.currentUser, Key key}) : super(key: key);
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {

  int _currentIndex = 0;
  // PageController _pageController = PageController(
  //   initialPage: 0,
  //   keepPage: true,
  // );
  final List<Widget> _children = [
   WelcomePage(),
   NotificationsPage()
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // backgroundColor: const Color(0xFFE9E9E9),
      body: _children[_currentIndex],
      // body: GestureDetector(
      //   behavior: HitTestBehavior.opaque,
      //   onTap: () => FocusScope.of(context).unfocus(),
      //   child: Stack(
      //     children: <Widget>[
      //       PageView(
      //         controller: _pageController,
      //         onPageChanged: (index) {
      //           setState(() => _currentIndex = index);
      //         },
      //         children: <Widget>[
      //           WelcomePage(),
      //           NotificationsPage(),
      //           WelcomePage(),
      //           NotificationsPage()
      //         ],
      //       ),
      //     ],
      //   ),
      // ),
      bottomNavigationBar: BottomNavigationDotBar ( // Usar -> "BottomNavigationDotBar"
          activeColor: Color(0xff0251ff),
          onTap: onTapTapped,
          currentIndex: _currentIndex,
          items: <BottomNavigationDotBarItem>[
            BottomNavigationDotBarItem(icon: Icon(Icons.home), onTap: () {}),
            BottomNavigationDotBarItem(icon: Icon(Icons.alarm_on), onTap: () {}),
            BottomNavigationDotBarItem(icon: Icon(Icons.brightness_7), onTap: () {}),
            BottomNavigationDotBarItem(icon: Icon(Icons.satellite), onTap: () {}),
            BottomNavigationDotBarItem(icon: Icon(Icons.notifications_none), hasNotification: true, onTap: () { /* Cualquier funcion - [abrir nueva venta] */ }),
          ]
      ),
    );
  }

  void onTapTapped(int index) {
    setState(() {
      _currentIndex = index;
      // _pageController.animateToPage(index,
      //     duration: Duration(milliseconds: 300), curve: Curves.easeOut);
    });
  }

}