refactor codes
This commit is contained in:
@@ -59,84 +59,93 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 717.0.h(),
|
||||
child: PageView.builder(
|
||||
controller: pageController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: widget.tenders.length,
|
||||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
currentPage = index + 1;
|
||||
});
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
final tender = widget.tenders[index];
|
||||
return TenderCard(tender: tender, isDesktop: widget.isDesktop);
|
||||
},
|
||||
),
|
||||
return SingleChildScrollView(
|
||||
child: Stack(children: [_tendersPageView(), _nextPreviousArrows()]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _tendersPageView() {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 719.0.h(),
|
||||
child: PageView.builder(
|
||||
controller: pageController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: widget.tenders.length,
|
||||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
currentPage = index + 1;
|
||||
});
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
final tender = widget.tenders[index];
|
||||
return TenderCard(tender: tender, isDesktop: widget.isDesktop);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _nextPreviousArrows() {
|
||||
return Positioned(
|
||||
top: 607.0.h(),
|
||||
bottom: 52.0.h(),
|
||||
left: 9.0.w(),
|
||||
right: 9.0.w(),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [_leftArrowButton(), _pageNumberText(), _rightArrowButton()],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _leftArrowButton() {
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
onTap: _goToPreviousPage,
|
||||
child: Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: AppColors.iconColor, width: 1.5),
|
||||
),
|
||||
Positioned(
|
||||
top: 607.0.h(),
|
||||
bottom: 52.0.h(),
|
||||
left: 9.0.w(),
|
||||
right: 9.0.w(),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: _goToPreviousPage,
|
||||
child: Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: AppColors.iconColor, width: 1.5),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.arrowLeftSmall,
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColors.iconColor,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$currentPage/${widget.tenders.length}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: _goToNextPage,
|
||||
child: Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: AppColors.iconColor, width: 1.5),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.arrowRightSmall,
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColors.iconColor,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.arrowLeftSmall,
|
||||
colorFilter: ColorFilter.mode(AppColors.iconColor, BlendMode.srcATop),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pageNumberText() {
|
||||
return Text(
|
||||
'$currentPage/${widget.tenders.length}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _rightArrowButton() {
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
onTap: _goToNextPage,
|
||||
child: Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: AppColors.iconColor, width: 1.5),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.arrowRightSmall,
|
||||
colorFilter: ColorFilter.mode(AppColors.iconColor, BlendMode.srcATop),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/data/services/model/home/tender/tender_model.dart';
|
||||
import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
|
||||
class TenderActionButtons extends StatelessWidget {
|
||||
final TenderModel tender;
|
||||
final bool isDesktop;
|
||||
|
||||
const TenderActionButtons({
|
||||
required this.tender,
|
||||
this.isDesktop = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final viewModel = context.watch<TendersViewModel>();
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 16.0.w()),
|
||||
|
||||
// Dislike button
|
||||
Tooltip(
|
||||
message: 'Dislike',
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleDislike(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.dislike,
|
||||
colorFilter: ColorFilter.mode(
|
||||
tender.disliked ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
'Dislike',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.disliked ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 32.0.w()),
|
||||
//reject button
|
||||
Tooltip(
|
||||
message: 'Reject',
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleReject(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
tender.rejected ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color:
|
||||
tender.rejected ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
'Reject',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.rejected ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 32.0.w()),
|
||||
//submit button
|
||||
Tooltip(
|
||||
message: 'Submit',
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleSubmit(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
tender.submitted ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.tick,
|
||||
colorFilter: ColorFilter.mode(
|
||||
tender.submitted ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
'Submit',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.submitted ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 32.0.w()),
|
||||
// Like button
|
||||
Tooltip(
|
||||
message: 'Like',
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleLike(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.like,
|
||||
colorFilter: ColorFilter.mode(
|
||||
tender.liked ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
'Like',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.liked ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/constants/strings.dart';
|
||||
import 'package:tm_app/data/services/model/home/tender/tender_model.dart';
|
||||
import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
|
||||
class TenderActionButtonsRow extends StatelessWidget {
|
||||
final TenderModel tender;
|
||||
final bool isDesktop;
|
||||
|
||||
const TenderActionButtonsRow({
|
||||
required this.tender,
|
||||
this.isDesktop = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final viewModel = context.watch<TendersViewModel>();
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 16.0.w()),
|
||||
|
||||
// Dislike button
|
||||
_dislikeButton(viewModel),
|
||||
SizedBox(width: 32.0.w()),
|
||||
//reject button
|
||||
_rejectButton(viewModel),
|
||||
SizedBox(width: 32.0.w()),
|
||||
//submit button
|
||||
_submitButton(viewModel),
|
||||
SizedBox(width: 32.0.w()),
|
||||
// Like button
|
||||
_likeButton(viewModel),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _rejectButton(TendersViewModel viewModel) {
|
||||
return Tooltip(
|
||||
message: AppStrings.reject,
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleReject(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
tender.rejected ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color:
|
||||
tender.rejected ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
AppStrings.reject,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.rejected ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _submitButton(TendersViewModel viewModel) {
|
||||
return Tooltip(
|
||||
message: AppStrings.submit,
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleSubmit(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
tender.submitted ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.tick,
|
||||
colorFilter: ColorFilter.mode(
|
||||
tender.submitted ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
AppStrings.submit,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.submitted ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _dislikeButton(TendersViewModel viewModel) {
|
||||
return Tooltip(
|
||||
message: AppStrings.dislike,
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleDislike(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.dislike,
|
||||
colorFilter: ColorFilter.mode(
|
||||
tender.disliked ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
AppStrings.dislike,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.disliked ?? false
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _likeButton(TendersViewModel viewModel) {
|
||||
return Tooltip(
|
||||
message: AppStrings.like,
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
viewModel.toggleLike(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.like,
|
||||
colorFilter: ColorFilter.mode(
|
||||
tender.liked ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
AppStrings.like,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
tender.liked ?? false
|
||||
? AppColors.successColor
|
||||
: AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
|
||||
class TenderAppBar extends StatelessWidget {
|
||||
const TenderAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||
child: 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import 'package:tm_app/data/services/model/home/tender/tender_model.dart';
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import 'tender_action_buttons.dart';
|
||||
import 'tender_action_buttons_row.dart';
|
||||
|
||||
class TenderCard extends StatelessWidget {
|
||||
final TenderModel tender;
|
||||
@@ -19,7 +19,6 @@ class TenderCard extends StatelessWidget {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
// width: 364.0.w(),
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16.0.w()),
|
||||
height: 587.0.h(),
|
||||
@@ -40,16 +39,9 @@ class TenderCard extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
tender.createdTime ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey60,
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
_dateText(),
|
||||
if (isDesktop)
|
||||
TenderActionButtons(
|
||||
TenderActionButtonsRow(
|
||||
tender: tender,
|
||||
isDesktop: isDesktop,
|
||||
),
|
||||
@@ -58,70 +50,19 @@ class TenderCard extends StatelessWidget {
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Deadline badge
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 24.0.h(),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppStrings.tenderDeadlineLabel,
|
||||
style: TextStyle(
|
||||
color: AppColors.textBlue,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
tender.deadline ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_deadlineBadge(),
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Title
|
||||
Text(
|
||||
tender.title ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
_tenderTitle(),
|
||||
SizedBox(height: 8.0.h()),
|
||||
|
||||
// Description
|
||||
Text(
|
||||
tender.description ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey70,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
_tenderDescription(),
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Tender ID
|
||||
Text(
|
||||
tender.tenderId ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
_idText(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -132,101 +73,21 @@ class TenderCard extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
// Match percentage
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppStrings.tenderMatchProfile,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${tender.profileMatch?.toInt() ?? 0}%',
|
||||
style: TextStyle(
|
||||
color: AppColors.secondaryTextColor,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_matchPercentage(),
|
||||
SizedBox(height: 8.0.h()),
|
||||
|
||||
// Progress bar
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 4.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey20,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
child: FractionallySizedBox(
|
||||
alignment: Alignment.centerLeft,
|
||||
widthFactor: tender.profileMatch ?? 0 / 100,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.secondary50,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_progressBar(),
|
||||
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(
|
||||
tender.location ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
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(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_locationInfo(),
|
||||
|
||||
// See More button
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
TenderDetailRouteData().push(context);
|
||||
},
|
||||
child: Container(
|
||||
width: 108.0.w(),
|
||||
height: 40.0.h(),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
child: Text(
|
||||
AppStrings.tenderSeeMore,
|
||||
style: TextStyle(
|
||||
color: AppColors.mainBlue,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_seeMoreButton(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -236,8 +97,178 @@ class TenderCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 72.0.h()),
|
||||
if (!isDesktop) TenderActionButtons(tender: tender),
|
||||
if (!isDesktop) TenderActionButtonsRow(tender: tender),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _dateText() {
|
||||
return Text(
|
||||
tender.createdTime ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey60,
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _deadlineBadge() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 24.0.h(),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppStrings.tenderDeadlineLabel,
|
||||
style: TextStyle(
|
||||
color: AppColors.textBlue,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
tender.deadline ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _tenderTitle() {
|
||||
return Text(
|
||||
tender.title ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _tenderDescription() {
|
||||
return Text(
|
||||
tender.description ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey70,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.5,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _idText() {
|
||||
return Text(
|
||||
tender.tenderId ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _matchPercentage() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppStrings.tenderMatchProfile,
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${tender.profileMatch ?? 0}%',
|
||||
style: TextStyle(
|
||||
color: AppColors.secondaryTextColor,
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _progressBar() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 4.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey20,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
child: FractionallySizedBox(
|
||||
alignment: Alignment.centerLeft,
|
||||
widthFactor: (tender.profileMatch ?? 0) / 100,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.secondary50,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _locationInfo() {
|
||||
return Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(AssetsManager.location),
|
||||
SizedBox(width: 4.0.w()),
|
||||
Text(
|
||||
tender.location ?? '',
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
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()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _seeMoreButton(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
TenderDetailRouteData().push(context);
|
||||
},
|
||||
child: Container(
|
||||
width: 108.0.w(),
|
||||
height: 40.0.h(),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
child: Text(
|
||||
AppStrings.tenderSeeMore,
|
||||
style: TextStyle(
|
||||
color: AppColors.mainBlue,
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export '../../shared/main_tab_bar.dart';
|
||||
export 'tender_app_bar.dart';
|
||||
export 'tender_card.dart';
|
||||
|
||||
Reference in New Issue
Block a user