ui_kit/lib/tabbar.dart
2025-05-27 16:40:56 +03:00

73 lines
2.2 KiB
Dart

// ignore_for_file: must_be_immutable
import 'package:flutter/material.dart';
import 'package:ui_kit/colors.dart';
import 'package:ui_kit/fonts.dart';
class TabBarWidget extends StatefulWidget {
TabBarWidget({super.key, required this.onTap, required this.selectedIndex});
int selectedIndex;
Function(int index) onTap;
@override
State<TabBarWidget> createState() => _TabBarWidgetState();
}
class _TabBarWidgetState extends State<TabBarWidget> {
@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: widget.selectedIndex,
selectedItemColor: primaryColor,
onTap: widget.onTap,
),
);
}
}