ui_kit/lib/tabbar.dart
2025-05-26 16:24:19 +03:00

76 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:ui_kit/colors.dart';
import 'package:ui_kit/fonts.dart';
class TabBarWidget extends StatefulWidget {
const TabBarWidget({super.key});
@override
State<TabBarWidget> createState() => _TabBarWidgetState();
}
class _TabBarWidgetState extends State<TabBarWidget> {
int _selectedIndex = 0;
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
@override
Widget build(BuildContext context) {
return SizedBox(
height: 51,
child: BottomNavigationBar(
showSelectedLabels: true,
showUnselectedLabels: true,
selectedLabelStyle: caption2Regular,
unselectedLabelStyle: caption2Regular,
type: BottomNavigationBarType.fixed,
unselectedItemColor: iconsColor,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Image.asset('assets/home.png', width: 18, height: 20),
label: 'Главная',
activeIcon: Image.asset(
'assets/home-active.png',
width: 18,
height: 20,
),
),
BottomNavigationBarItem(
icon: Image.asset('assets/results.png', width: 18, height: 20),
label: 'Каталог',
activeIcon: Image.asset(
'assets/results-active.png',
width: 18,
height: 20,
),
),
BottomNavigationBarItem(
icon: Image.asset('assets/projects.png', width: 18, height: 20),
label: 'Проекты',
activeIcon: Image.asset(
'assets/projects-active.png',
width: 18,
height: 20,
),
),
BottomNavigationBarItem(
icon: Image.asset('assets/profile.png', width: 18, height: 20),
label: 'Профиль',
activeIcon: Image.asset(
'assets/profile-active.png',
width: 18,
height: 20,
),
),
],
currentIndex: _selectedIndex,
selectedItemColor: primaryColor,
onTap: _onItemTapped,
),
);
}
}