Remove unused DetailDropDown and TenderDetailCard components to streamline codebase and improve maintainability. These components were previously disabled and retained for potential future use.

This commit is contained in:
AmirReza Jamali
2026-06-06 12:25:49 +03:30
parent 86ed7bc665
commit aa9c9444fa
3 changed files with 16 additions and 188 deletions
@@ -1,86 +0,0 @@
// Currently unused — previously used by the mock sections in TenderDetailHeader,
// which are now disabled. Kept for when those sections are re-enabled.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tm_app/core/utils/size_config.dart';
import '../../../core/theme/colors.dart';
class DetailDropDown extends StatefulWidget {
final String title;
final List<String> items;
const DetailDropDown({required this.title, required this.items, super.key});
@override
State<DetailDropDown> createState() => _DetailDropDownState();
}
class _DetailDropDownState extends State<DetailDropDown>
with SingleTickerProviderStateMixin {
bool isOpen = true;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
InkWell(
onTap: () {
setState(() {
isOpen = !isOpen;
});
},
child: Container(
width: 24.0.w(),
height: 24.0.h(),
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: AppColors.grey60),
),
alignment: Alignment.center,
child: Icon(
isOpen
? CupertinoIcons.chevron_up
: CupertinoIcons.chevron_down,
color: AppColors.grey60,
size: 12,
),
),
),
SizedBox(width: 8.0.w()),
Text(
widget.title,
style: TextStyle(
color: AppColors.grey80,
fontSize: 16.0.sp(),
fontWeight: FontWeight.w600,
),
),
],
),
SizedBox(height: 12.0.h()),
isOpen
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:
widget.items
.map(
(e) => Padding(
padding: EdgeInsets.only(left: 12.0.w()),
child: Text(e),
),
)
.toList(),
)
: const SizedBox.shrink(),
],
);
}
}
@@ -1,98 +0,0 @@
// Currently unused — its usages on the tender-details pages are disabled because
// it renders a static/mock "profile match + incomplete resume" card rather than
// backend data. Kept for when the profile-match score is available from the API.
import 'package:flutter/material.dart';
import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import 'package:tm_app/views/detail/strings/tender_details_strings.dart';
class TenderDetailCard extends StatelessWidget {
final TenderData detail;
const TenderDetailCard({required this.detail, super.key});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.paleOrange,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColors.veryPaleOrange),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
TenderDetailsStrings.tenderMatchProfile,
style: TextStyle(
fontSize: 12.0.sp(),
color: AppColors.grey80,
fontWeight: FontWeight.w400,
),
),
Text(
'75%',
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.jellyBean,
),
),
],
),
SizedBox(height: 6.0.h()),
ClipRRect(
borderRadius: BorderRadius.circular(4),
child: LinearProgressIndicator(
value: 0.75,
backgroundColor: AppColors.grey20,
valueColor: const AlwaysStoppedAnimation<Color>(
AppColors.jellyBean,
),
minHeight: 6.0.h(),
),
),
SizedBox(height: 16.0.h()),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(Icons.warning_rounded, color: AppColors.red),
SizedBox(width: 8.0.w()),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TenderDetailsStrings.tenderIncompleteResume,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0.sp(),
color: AppColors.grey80,
),
),
SizedBox(height: 4.0.h()),
Text(
TenderDetailsStrings.tenderNoExperience,
style: TextStyle(
fontSize: 14.0.sp(),
color: AppColors.grey70,
fontWeight: FontWeight.w400,
),
),
],
),
),
],
),
],
),
);
}
}
@@ -35,8 +35,13 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
// The scroll controller is only attached to the desktop ListView, so only
// register the prefetch listener there. Mobile prefetching is driven by
// PageView's onPageChanged instead.
if (widget.isDesktop) {
_scrollController.addListener(_onScroll); _scrollController.addListener(_onScroll);
} }
}
void _onScroll() { void _onScroll() {
if (!_scrollController.hasClients) { if (!_scrollController.hasClients) {
@@ -140,6 +145,10 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
controller: pageController, controller: pageController,
itemCount: widget.tenders.length, itemCount: widget.tenders.length,
onPageChanged: (index) { onPageChanged: (index) {
// currentPage is still the previous page here; a forward swipe means
// the new (1-indexed) page is greater than the old one.
final bool isForwardSwipe = index + 1 > currentPage;
setState(() { setState(() {
currentPage = index + 1; currentPage = index + 1;
}); });
@@ -150,9 +159,12 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
viewModel.getTenderFeedback(id); viewModel.getTenderFeedback(id);
} }
// Infinite scroll: once we pass the halfway point of the loaded // Infinite scroll: once we swipe forward past the halfway point of the
// tenders, prefetch the next page in the background. // loaded tenders, prefetch the next page in the background. Skip
if (index >= (widget.tenders.length * _prefetchFraction).floor()) { // back-swipes so we don't refetch while the user reviews earlier
// tenders.
if (isForwardSwipe &&
index >= (widget.tenders.length * _prefetchFraction).floor()) {
_maybeLoadMore(); _maybeLoadMore();
} }
}, },