check and fix in ui
This commit is contained in:
@@ -1,167 +1,207 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
import 'package:tm_app/views/tenders/models/tender_model.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
|
||||
class TenderActionButtons extends StatelessWidget {
|
||||
final VoidCallback? onLike;
|
||||
final VoidCallback? onDislike;
|
||||
final VoidCallback? onClose;
|
||||
final VoidCallback? onReject;
|
||||
final VoidCallback? onSubmit;
|
||||
final bool isLiked;
|
||||
final bool isDisliked;
|
||||
final bool rejected;
|
||||
final bool submitted;
|
||||
final Tender tender;
|
||||
final bool isDesktop;
|
||||
|
||||
const TenderActionButtons({
|
||||
required this.tender,
|
||||
this.isDesktop = false,
|
||||
super.key,
|
||||
this.onLike,
|
||||
this.onDislike,
|
||||
this.onClose,
|
||||
this.onReject,
|
||||
this.onSubmit,
|
||||
this.isLiked = false,
|
||||
this.isDisliked = false,
|
||||
this.rejected = false,
|
||||
this.submitted = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final viewModel = context.watch<TendersViewModel>();
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 16.0.w()),
|
||||
|
||||
// Dislike button
|
||||
GestureDetector(
|
||||
onTap: onDislike,
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.dislike,
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDisliked ? AppColors.errorColor : AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
Tooltip(
|
||||
message: 'Dislike',
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
viewModel.onDislike(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.dislike,
|
||||
colorFilter: ColorFilter.mode(
|
||||
viewModel.dislikedTenders.contains(tender)
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Text(
|
||||
'Like',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: isDisliked ? AppColors.errorColor : AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
'Like',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
viewModel.dislikedTenders.contains(tender)
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 32.0.w()),
|
||||
//reject button
|
||||
GestureDetector(
|
||||
onTap: onReject,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: rejected ? AppColors.errorColor : AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
Tooltip(
|
||||
message: 'Reject',
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
viewModel.onReject(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
viewModel.rejectedTenders.contains(tender)
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color:
|
||||
viewModel.rejectedTenders.contains(tender)
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: rejected ? AppColors.errorColor : AppColors.grey60,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Text(
|
||||
'Reject',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: rejected ? AppColors.errorColor : AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
'Reject',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
viewModel.rejectedTenders.contains(tender)
|
||||
? AppColors.errorColor
|
||||
: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 32.0.w()),
|
||||
//submit button
|
||||
GestureDetector(
|
||||
onTap: onSubmit,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
submitted ? AppColors.successColor : AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
Tooltip(
|
||||
message: 'Submit',
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
viewModel.onSubmit(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
viewModel.submittedTenders.contains(tender)
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.tick,
|
||||
colorFilter: ColorFilter.mode(
|
||||
viewModel.submittedTenders.contains(tender)
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.tick,
|
||||
colorFilter: ColorFilter.mode(
|
||||
submitted ? 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:
|
||||
viewModel.submittedTenders.contains(tender)
|
||||
? AppColors.successColor
|
||||
: AppColors.grey60,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Text(
|
||||
'Submit',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: submitted ? AppColors.successColor : AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 32.0.w()),
|
||||
// Like button
|
||||
GestureDetector(
|
||||
onTap: onLike,
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.like,
|
||||
colorFilter: ColorFilter.mode(
|
||||
isLiked ? AppColors.successColor : AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
Tooltip(
|
||||
message: 'Like',
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
viewModel.onLike(tender);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
width: 32.0.w(),
|
||||
height: 32.0.w(),
|
||||
fit: BoxFit.cover,
|
||||
AssetsManager.like,
|
||||
colorFilter: ColorFilter.mode(
|
||||
viewModel.likedTenders.contains(tender)
|
||||
? AppColors.successColor
|
||||
: AppColors.grey50,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
Text(
|
||||
'Like',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: isLiked ? AppColors.successColor : AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 8.0.h()),
|
||||
if (!isDesktop)
|
||||
Text(
|
||||
'Like',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
viewModel.likedTenders.contains(tender)
|
||||
? AppColors.successColor
|
||||
: AppColors.grey50,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user