Files
tm_app/lib/common/widgets/bottom_navigation.dart
T
2025-08-03 10:50:34 +03:30

98 lines
2.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import '../../core/utils/size_config.dart';
class BottomNavigation extends StatefulWidget {
const BottomNavigation({super.key});
@override
State<BottomNavigation> createState() => _BottomNavigationState();
}
class _BottomNavigationState extends State<BottomNavigation> {
int activeTab = 0;
@override
Widget build(BuildContext context) {
return Container(
height: 72.0.h(),
decoration: BoxDecoration(
color: Color(0xFFE3E3E3),
border: Border.fromBorderSide(BorderSide(color: Color(0xFFE3E3E3))),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_bottomNavigationItem(
text: 'Home',
isActive: activeTab == 0,
onTap: () {
setState(() {
activeTab = 0;
});
},
iconPath: 'assets/icons/home.svg',
activeIconPath: 'assets/icons/homeActive.svg',
),
_bottomNavigationItem(
text: 'Tenders',
isActive: activeTab == 1,
onTap: () {
setState(() {
activeTab = 1;
});
},
iconPath: 'assets/icons/task_square.svg',
activeIconPath: 'assets/icons/task-square_active.svg',
),
_bottomNavigationItem(
text: 'Profile',
isActive: activeTab == 2,
onTap: () {
setState(() {
activeTab = 2;
});
},
iconPath: 'assets/icons/profile-circle.svg',
activeIconPath: 'assets/icons/profile-circle_active.svg',
),
],
),
);
}
Widget _bottomNavigationItem({
required String text,
required bool isActive,
required VoidCallback onTap,
required String iconPath,
required String activeIconPath,
}) {
return InkWell(
onTap: onTap,
child: SizedBox(
width: 64.0.w(),
height: 72.0.h(),
child: Padding(
padding: EdgeInsets.only(top: 12.0.h(), bottom: 14.0.h()),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SvgPicture.asset(isActive ? activeIconPath : iconPath),
Text(
text,
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
color: isActive ? Color(0xFF0164FF) : Color(0xFF777777),
),
),
],
),
),
),
);
}
}