242 lines
6.9 KiB
Dart
242 lines
6.9 KiB
Dart
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/tender_data/tender_data.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 TenderData 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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|