import 'package:animated_bottom_navigation_bar/animated_bottom_navigation_bar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/screens/landing/landing_controller.dart';
import 'package:sk_base_mobile/services/app_info.service.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
import 'package:auto_size_text/auto_size_text.dart';

class BottomNavBar extends StatelessWidget {
  BottomNavBar({super.key});
  final controller = Get.put(LandingController());
  final autoSizeGroup = AutoSizeGroup();
  @override
  Widget build(BuildContext context) {
    return Obx(
      () => AnimatedBottomNavigationBar.builder(
        itemCount: controller.pages.length,
        elevation: ScreenAdaper.height(30),
        height: ScreenAdaper.height(100),
        activeIndex: controller.currentIndex.value,
        gapLocation: GapLocation.center,
        notchSmoothness: NotchSmoothness.verySmoothEdge,
        leftCornerRadius: ScreenAdaper.sp(25),
        rightCornerRadius: ScreenAdaper.sp(25),
        onTap: (index) {
          controller.currentIndex.value = index;
        },
        tabBuilder: (int index, bool isActive) {
          final color = isActive
              ? AppTheme.activeNavigationBarColor
              : AppTheme.notActiveNavigationBarColor;
          return Column(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Icon(
                AppInfoService.to.bottomNavItems![index].icon,
                size: ScreenAdaper.sp(40),
                color: color,
              ),
              AutoSizeText(
                AppInfoService.to.bottomNavItems![index].label ?? '',
                maxLines: 1,
                style: TextStyle(color: color, fontSize: ScreenAdaper.sp(20)),
                group: autoSizeGroup,
              ),
            ],
          );
        },
      ),
    );
  }
}
// BottomNavigationBar(
//           iconSize: ScreenAdaper.sp(40),
//           type: BottomNavigationBarType.fixed,
//           items: bottomNavItems,
//           showSelectedLabels: true,
//           showUnselectedLabels: true,
//           currentIndex: _selectedLanding,
//           onTap: (landing) {
//             _onItemTapped(landing);
//           },
//         )