Implement tender workflows and dashboard integration
continuous-integration/drone/push Build encountered an error

This commit is contained in:
AmirReza Jamali
2026-07-14 11:12:09 +03:30
parent ce170f9bc8
commit 72881df210
29 changed files with 1820 additions and 159 deletions
@@ -8,6 +8,7 @@ class AnimatedFeedbackButton extends StatefulWidget {
final Color activeColor;
final Color inactiveColor;
final bool isActive;
final bool isLoading;
final VoidCallback onTap;
final String tooltip;
@@ -18,6 +19,7 @@ class AnimatedFeedbackButton extends StatefulWidget {
required this.isActive,
required this.onTap,
required this.tooltip,
this.isLoading = false,
super.key,
});
@@ -63,6 +65,9 @@ class _AnimatedFeedbackButtonState extends State<AnimatedFeedbackButton>
}
void _handleTap() {
if (widget.isLoading) {
return;
}
_clickController.forward().then((_) {
_clickController.reverse();
});
@@ -75,7 +80,7 @@ class _AnimatedFeedbackButtonState extends State<AnimatedFeedbackButton>
message: widget.tooltip,
child: InkWell(
splashColor: Colors.transparent,
onTap: _handleTap,
onTap: widget.isLoading ? null : _handleTap,
child: AnimatedBuilder(
animation: _clickController,
builder: (context, child) {
@@ -94,15 +99,23 @@ class _AnimatedFeedbackButtonState extends State<AnimatedFeedbackButton>
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
builder: (context, color, child) {
return SvgPicture.asset(
return SizedBox(
width: 24.0.w(),
height: 24.0.w(),
fit: BoxFit.cover,
widget.iconPath,
colorFilter: ColorFilter.mode(
color ?? widget.inactiveColor,
BlendMode.srcATop,
),
child:
widget.isLoading
? CircularProgressIndicator(
strokeWidth: 2,
color: color ?? widget.inactiveColor,
)
: SvgPicture.asset(
fit: BoxFit.cover,
widget.iconPath,
colorFilter: ColorFilter.mode(
color ?? widget.inactiveColor,
BlendMode.srcATop,
),
),
);
},
),
@@ -41,6 +41,52 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
if (widget.isDesktop) {
_scrollController.addListener(_onScroll);
}
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
_hydrateRenderedFeedback();
}
});
}
@override
void didUpdateWidget(covariant MainTendersSlider oldWidget) {
super.didUpdateWidget(oldWidget);
final oldIds = oldWidget.tenders.map((tender) => tender.id).toList();
final newIds = widget.tenders.map((tender) => tender.id).toList();
if (oldIds.length != newIds.length ||
!Iterable<int>.generate(
newIds.length,
).every((index) => oldIds[index] == newIds[index])) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
_hydrateRenderedFeedback();
}
});
}
}
void _hydrateRenderedFeedback() {
if (widget.tenders.isEmpty) {
return;
}
final viewModel = context.read<TendersViewModel>();
final tendersToHydrate =
widget.isDesktop
? widget.tenders
: <TenderData>[
widget.tenders[(currentPage - 1).clamp(
0,
widget.tenders.length - 1,
)],
];
for (final tender in tendersToHydrate) {
final id = tender.id;
if (id != null && id.isNotEmpty) {
viewModel.getTenderFeedback(id);
}
}
}
void _onScroll() {
@@ -48,6 +48,7 @@ class TenderActionButtonsRow extends StatelessWidget {
final feedback = viewModel.getFeedbackForTender(tender.id!);
final isDisliked = feedback?.feedbackType == TenderFeedback.disliked.value;
final isLoading = viewModel.isFeedbackLoading(tender.id!);
return Column(
children: [
@@ -56,9 +57,10 @@ class TenderActionButtonsRow extends StatelessWidget {
activeColor: AppColors.errorColor,
inactiveColor: AppColors.grey50,
isActive: isDisliked,
isLoading: isLoading,
tooltip: TendersStrings.dislike,
onTap: () {
viewModel.toogleFeedback(
viewModel.toggleFeedback(
tenderId: tender.id!,
feedbackType: TenderFeedback.disliked.value,
);
@@ -85,6 +87,7 @@ class TenderActionButtonsRow extends StatelessWidget {
final feedback = viewModel.getFeedbackForTender(tender.id!);
final isLiked = feedback?.feedbackType == TenderFeedback.liked.value;
final isLoading = viewModel.isFeedbackLoading(tender.id!);
return Column(
children: [
@@ -93,9 +96,10 @@ class TenderActionButtonsRow extends StatelessWidget {
activeColor: AppColors.successColor,
inactiveColor: AppColors.grey50,
isActive: isLiked,
isLoading: isLoading,
tooltip: TendersStrings.like,
onTap: () {
viewModel.toogleFeedback(
viewModel.toggleFeedback(
tenderId: tender.id!,
feedbackType: TenderFeedback.liked.value,
);