mobile_skt/lib/widgets/bottom_nav_bar.dart

64 lines
2.3 KiB
Dart

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/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(80),
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(
controller.iconList[index],
size: ScreenAdaper.sp(40),
color: color,
),
AutoSizeText(
controller.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);
// },
// )