mobile_skt/lib/widgets/bottom_nav_bar.dart

66 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(20),
height: ScreenAdaper.height(100),
activeIndex: controller.currentIndex.value,
gapLocation: GapLocation.center,
notchMargin: ScreenAdaper.height(10),
notchSmoothness: NotchSmoothness.smoothEdge,
leftCornerRadius: ScreenAdaper.sp(40),
rightCornerRadius: ScreenAdaper.sp(40),
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.bottomNavItems![index].icon,
size: ScreenAdaper.height(40),
color: color,
),
AutoSizeText(
controller.bottomNavItems![index].label ?? '',
maxLines: 1,
style:
TextStyle(color: color, fontSize: ScreenAdaper.height(20)),
group: autoSizeGroup,
),
],
);
},
),
);
}
}
// BottomNavigationBar(
// iconsize: ScreenAdaper.height(40),
// type: BottomNavigationBarType.fixed,
// items: bottomNavItems,
// showSelectedLabels: true,
// showUnselectedLabels: true,
// currentIndex: _selectedLanding,
// onTap: (landing) {
// _onItemTapped(landing);
// },
// )