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,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LastTendersTab extends StatelessWidget {
|
||||
const LastTendersTab({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(color: Colors.blue);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/constants/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
|
||||
class TabItem extends StatelessWidget {
|
||||
const TabItem({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.isActive,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final bool isActive;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Tab(
|
||||
child: SizedBox(
|
||||
width: 170.0.w(),
|
||||
child: Center(
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isActive ? AppColors.mainBlue : AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/colors.dart';
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
|
||||
class TenderAppBar extends StatelessWidget {
|
||||
const TenderAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppStrings.tendersTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
AssetsManager.tenderLogo,
|
||||
width: 59.0.w(),
|
||||
height: 28.0.h(),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
|
||||
class TenderCard extends StatelessWidget {
|
||||
final String date;
|
||||
final String deadline;
|
||||
final String title;
|
||||
final String description;
|
||||
final String tenderId;
|
||||
final String location;
|
||||
final String country;
|
||||
final double matchPercentage;
|
||||
final VoidCallback? onApply;
|
||||
final VoidCallback? onLike;
|
||||
final VoidCallback? onDislike;
|
||||
final VoidCallback? onClose;
|
||||
final bool isLiked;
|
||||
final bool isDisliked;
|
||||
|
||||
const TenderCard({
|
||||
super.key,
|
||||
required this.date,
|
||||
required this.deadline,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.tenderId,
|
||||
required this.location,
|
||||
required this.country,
|
||||
required this.matchPercentage,
|
||||
this.onApply,
|
||||
this.onLike,
|
||||
this.onDislike,
|
||||
this.onClose,
|
||||
this.isLiked = false,
|
||||
this.isDisliked = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 364.0.w(),
|
||||
height: 587.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey0,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.borderColor),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Main content
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16.0.w()),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Date
|
||||
Text(
|
||||
date,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey60,
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Deadline badge
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 24.0.h(),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 8.0.w(),
|
||||
vertical: 4.0.h(),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary2,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Deadline:',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainBlue,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
deadline,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Title
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
|
||||
// Description
|
||||
Text(
|
||||
description,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey70,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Tender ID
|
||||
Text(
|
||||
tenderId,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey60,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
// Bottom section with progress and actions
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16.0.w()),
|
||||
child: Column(
|
||||
children: [
|
||||
// Match percentage
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Match with your profile',
|
||||
style: TextStyle(
|
||||
color: AppColors.primaryTextColor,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${matchPercentage.toInt()}%',
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF2484A8),
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
|
||||
// Progress bar
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 4.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey10,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
child: FractionallySizedBox(
|
||||
alignment: Alignment.centerLeft,
|
||||
widthFactor: matchPercentage / 100,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF34BC9B),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
|
||||
// Location and apply button
|
||||
Row(
|
||||
children: [
|
||||
// Location info
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(AssetsManager.location),
|
||||
SizedBox(width: 4.0.w()),
|
||||
Text(
|
||||
location,
|
||||
style: TextStyle(
|
||||
color: AppColors.primaryTextColor,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.0.w()),
|
||||
// Country flag placeholder
|
||||
Image.asset(
|
||||
AssetsManager.seFlag,
|
||||
width: 32.0.w(),
|
||||
height: 21.0.h(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Apply button
|
||||
GestureDetector(
|
||||
onTap: onApply,
|
||||
child: Container(
|
||||
width: 108.0.w(),
|
||||
height: 40.0.h(),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary2,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
child: Text(
|
||||
'See More',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainBlue,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24.0.h()),
|
||||
TenderActionButtons(
|
||||
isDisliked: isDisliked,
|
||||
isLiked: isLiked,
|
||||
onDislike: onDislike,
|
||||
onLike: onLike,
|
||||
onClose: onClose,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Action buttons row widget
|
||||
class TenderActionButtons extends StatelessWidget {
|
||||
final VoidCallback? onLike;
|
||||
final VoidCallback? onDislike;
|
||||
final VoidCallback? onClose;
|
||||
final bool isLiked;
|
||||
final bool isDisliked;
|
||||
|
||||
const TenderActionButtons({
|
||||
super.key,
|
||||
this.onLike,
|
||||
this.onDislike,
|
||||
this.onClose,
|
||||
this.isLiked = false,
|
||||
this.isDisliked = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 16.0.w()),
|
||||
|
||||
// Dislike button
|
||||
GestureDetector(
|
||||
onTap: onDislike,
|
||||
child: SvgPicture.asset(AssetsManager.dislike),
|
||||
),
|
||||
|
||||
SizedBox(width: 16.0.w()),
|
||||
|
||||
// Close button
|
||||
GestureDetector(
|
||||
onTap: onClose,
|
||||
child: SvgPicture.asset(AssetsManager.closeCircle),
|
||||
),
|
||||
SizedBox(width: 16.0.w()),
|
||||
// Like button
|
||||
GestureDetector(
|
||||
onTap: onLike,
|
||||
child: SvgPicture.asset(AssetsManager.like),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export 'last_tenders_tab.dart';
|
||||
export 'main_tab_bar.dart';
|
||||
export 'tender_app_bar.dart';
|
||||
export 'tender_card.dart';
|
||||
Reference in New Issue
Block a user