import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/homepage/homepage_view.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/portfolio/portfolio_view.dart';
import 'package:flutter/material.dart';

class BottomNavigationView extends StatefulWidget {
  const BottomNavigationView({Key? key}) : super(key: key);

  @override
  State<BottomNavigationView> createState() => _BottomNavigationViewState();
}

class _BottomNavigationViewState extends State<BottomNavigationView> {
  int _selectedIndex = 0;

  @override
  Widget build(BuildContext context) {
    ///TODO: masukan pagenya dilistWidget ini
    List<Widget> listWidget = [
      HomeView(),
      Container(
        color: Colors.redAccent,
      ),
      Container(),
      PortofolioView(),
      Container(),
    ];

    List<BottomNavigationBarItem> listNavigation = const [
      BottomNavigationBarItem(
        icon: Icon(Icons.home_outlined),
        label: 'Home',
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.search),
        label: 'Search',
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.compare_arrows),
        label: 'Transaction',
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.pie_chart_rounded),
        label: 'Portfolio',
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.person),
        label: 'Profile',
      ),
    ];

    return Scaffold(
      body: listWidget[_selectedIndex],
      bottomNavigationBar: BottomNavigationBar(
        onTap: (value) {
          setState(() {
            _selectedIndex = value;
          });
        },
        currentIndex: _selectedIndex,
        items: listNavigation,
        type: BottomNavigationBarType.fixed,
        showUnselectedLabels: true,
        selectedItemColor: ColorPalette.primary,
        unselectedItemColor: Colors.black,
        selectedLabelStyle: const TextStyle(color: ColorPalette.primary),
        unselectedLabelStyle: const TextStyle(color: Colors.black),
      ),
    );
  }
}
