Refactor: rename BottomNavigation and update TendersScreen structure
- Renamed BottomNavigation to TenderBottomNavigation for clarity. - Updated TendersScreen to use TenderBottomNavigation. - Converted TendersScreen from StatelessWidget to StatefulWidget to manage tab state. - Added TabController for handling tab changes and improved layout with SafeArea and PageView.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/constants/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import 'tab_item.dart';
|
||||
|
||||
class MainTabBar extends StatefulWidget {
|
||||
const MainTabBar({super.key, required this.controller});
|
||||
|
||||
final TabController controller;
|
||||
|
||||
@override
|
||||
State<MainTabBar> createState() => _MainTabBarState();
|
||||
}
|
||||
|
||||
class _MainTabBarState extends State<MainTabBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 51.0.h(),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0.w(), vertical: 8.0.h()),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey10,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: TabBar(
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
dividerColor: Colors.transparent,
|
||||
indicator: BoxDecoration(
|
||||
color: AppColors.backgroundColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.12),
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
controller: widget.controller,
|
||||
tabs: [
|
||||
TabItem(
|
||||
title: 'New',
|
||||
isActive: widget.controller.index == 0,
|
||||
onTap: () {
|
||||
widget.controller.animateTo(0);
|
||||
},
|
||||
),
|
||||
TabItem(
|
||||
title: 'Last',
|
||||
isActive: widget.controller.index == 1,
|
||||
onTap: () {
|
||||
widget.controller.animateTo(1);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user