refactor home
This commit is contained in:
@@ -13,6 +13,9 @@ class AppShellScreen extends StatelessWidget {
|
|||||||
final StatefulNavigationShell navigationShell;
|
final StatefulNavigationShell navigationShell;
|
||||||
|
|
||||||
void _gotoBranch(int index, BuildContext context) {
|
void _gotoBranch(int index, BuildContext context) {
|
||||||
|
if (index == navigationShell.currentIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
navigationShell.goBranch(
|
navigationShell.goBranch(
|
||||||
index,
|
index,
|
||||||
initialLocation: index == navigationShell.currentIndex,
|
initialLocation: index == navigationShell.currentIndex,
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ class AppColors {
|
|||||||
// static const Color red0 = Color(0xFF312F2F);
|
// static const Color red0 = Color(0xFF312F2F);
|
||||||
// static const Color red10 = Color(0xFF524545);
|
// static const Color red10 = Color(0xFF524545);
|
||||||
static const Color red = Color(0xFFFF3B30);
|
static const Color red = Color(0xFFFF3B30);
|
||||||
|
static const Color orange = Color(0xFFE5821E);
|
||||||
|
|
||||||
// Other colors
|
// Other colors
|
||||||
static const Color lightBlue = Color(0xFFe8ecfc);
|
static const Color lightBlue = Color(0xFFe8ecfc);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TendersRepository {
|
|||||||
return _tendersService.getTenderFeedback(tenderId: tenderId);
|
return _tendersService.getTenderFeedback(tenderId: tenderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Result<FeedbackResponse>> feedback({
|
Future<Result<FeedbackResponse>> toggleFeedback({
|
||||||
required String tenderId,
|
required String tenderId,
|
||||||
required String feedbackType,
|
required String feedbackType,
|
||||||
}) async {
|
}) async {
|
||||||
|
|||||||
@@ -165,4 +165,27 @@ class HomeViewModel with ChangeNotifier {
|
|||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculation methods for progress bars
|
||||||
|
double get partnershipCount {
|
||||||
|
return tenderApprovalsStateResponse?.data?.partnershipCount?.toDouble() ??
|
||||||
|
0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double get selfApplyCount {
|
||||||
|
return tenderApprovalsStateResponse?.data?.selfApplyCount?.toDouble() ??
|
||||||
|
0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double get totalCount {
|
||||||
|
return partnershipCount + selfApplyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
double get partnershipPercent {
|
||||||
|
return totalCount > 0 ? (partnershipCount / totalCount) * 100 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double get selfApplyPercent {
|
||||||
|
return totalCount > 0 ? (selfApplyCount / totalCount) * 100 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,14 +248,14 @@ class TendersViewModel with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> feedback({
|
Future<void> toogleFeedback({
|
||||||
required String tenderId,
|
required String tenderId,
|
||||||
required String feedbackType,
|
required String feedbackType,
|
||||||
}) async {
|
}) async {
|
||||||
_feedbackErrorMessage = null;
|
_feedbackErrorMessage = null;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
final result = await _tendersRepository.feedback(
|
final result = await _tendersRepository.toggleFeedback(
|
||||||
tenderId: tenderId,
|
tenderId: tenderId,
|
||||||
feedbackType: feedbackType,
|
feedbackType: feedbackType,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:tm_app/core/constants/strings.dart';
|
|||||||
import 'package:tm_app/core/routes/app_routes.dart';
|
import 'package:tm_app/core/routes/app_routes.dart';
|
||||||
import 'package:tm_app/core/theme/colors.dart';
|
import 'package:tm_app/core/theme/colors.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/data/services/model/tender_approvals_state_response/tender_approvals_state_response.dart';
|
|
||||||
import 'package:tm_app/view_models/home_view_model.dart';
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
import 'package:tm_app/views/shared/desktop_navigation_widget.dart';
|
import 'package:tm_app/views/shared/desktop_navigation_widget.dart';
|
||||||
|
|
||||||
@@ -30,111 +29,99 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
return Center(child: Text(homeViewModel.errorMessage!));
|
return Center(child: Text(homeViewModel.errorMessage!));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Column(
|
if (homeViewModel.tenderApprovalsStateResponse != null &&
|
||||||
children: [
|
homeViewModel.data != null &&
|
||||||
DesktopNavigationWidget(
|
homeViewModel.feedbackStats != null) {
|
||||||
currentIndex: 0, // Home index
|
return Column(
|
||||||
onTabChanged: (index) {
|
children: [
|
||||||
// Navigate to different screens based on index
|
DesktopNavigationWidget(
|
||||||
switch (index) {
|
currentIndex: 0, // Home index
|
||||||
case 0:
|
onTabChanged: (index) {
|
||||||
// Already on home
|
// Navigate to different screens based on index
|
||||||
break;
|
switch (index) {
|
||||||
case 1:
|
case 0:
|
||||||
// Navigate to tenders
|
// Already on home
|
||||||
Router.neglect(context, () => context.go('/tenders'));
|
break;
|
||||||
break;
|
case 1:
|
||||||
case 2:
|
// Navigate to tenders
|
||||||
// Navigate to profile
|
Router.neglect(context, () => context.go('/tenders'));
|
||||||
Router.neglect(context, () => context.go('/profile'));
|
break;
|
||||||
break;
|
case 2:
|
||||||
}
|
// Navigate to profile
|
||||||
},
|
Router.neglect(context, () => context.go('/profile'));
|
||||||
),
|
break;
|
||||||
Expanded(
|
}
|
||||||
child: Center(
|
},
|
||||||
child: SizedBox(
|
),
|
||||||
width: 780,
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: Center(
|
||||||
child: Column(
|
child: SizedBox(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
width: 780,
|
||||||
children: [
|
child: SingleChildScrollView(
|
||||||
SizedBox(height: 55),
|
child: Column(
|
||||||
// SizedBox(width: 780, child: NotificationCard()),
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
SizedBox(height: 40.0),
|
children: [
|
||||||
_progressBarsRow(
|
SizedBox(height: 55),
|
||||||
homeViewModel.tenderApprovalsStateResponse!,
|
// SizedBox(width: 780, child: NotificationCard()),
|
||||||
),
|
SizedBox(height: 40.0),
|
||||||
SizedBox(height: 32.0.h()),
|
_progressBarsRow(homeViewModel),
|
||||||
Padding(
|
SizedBox(height: 32.0.h()),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 15.0.w()),
|
Padding(
|
||||||
child: _firstTenderCardsRow(
|
padding: EdgeInsets.symmetric(
|
||||||
context,
|
horizontal: 15.0.w(),
|
||||||
homeViewModel.tenderApprovalsStateResponse!,
|
),
|
||||||
homeViewModel,
|
child: _firstTenderCardsRow(
|
||||||
|
context,
|
||||||
|
homeViewModel,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(height: 32.0.h()),
|
||||||
SizedBox(height: 32.0.h()),
|
_yourTenderText(homeViewModel),
|
||||||
_yourTenderText(homeViewModel),
|
SizedBox(height: 8.0.h()),
|
||||||
SizedBox(height: 8.0.h()),
|
_bottomListView(homeViewModel),
|
||||||
_bottomListView(homeViewModel),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
|
}
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow(
|
Widget _progressBarsRow(HomeViewModel homeViewModel) {
|
||||||
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
|
||||||
) {
|
|
||||||
final partnership =
|
|
||||||
tenderApprovalsStateResponse.data!.partnershipCount ?? 0;
|
|
||||||
final selfApply = tenderApprovalsStateResponse.data!.selfApplyCount ?? 0;
|
|
||||||
final total = (partnership + selfApply);
|
|
||||||
|
|
||||||
final partnershipPercent = total > 0 ? (partnership / total) * 100 : 0;
|
|
||||||
final selfApplyPercent = total > 0 ? (selfApply / total) * 100 : 0;
|
|
||||||
return Row(
|
return Row(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: double.parse('$partnershipPercent'),
|
value: homeViewModel.partnershipPercent,
|
||||||
amount: double.parse('$partnershipPercent').toString(),
|
amount: homeViewModel.partnershipPercent.toString(),
|
||||||
circularProgressIndicatorWidth: 176,
|
circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
circularProgressIndicatorHeight: 176,
|
||||||
),
|
),
|
||||||
SizedBox(width: 106),
|
SizedBox(width: 106),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: double.parse(selfApplyPercent.toString()),
|
value: homeViewModel.selfApplyPercent,
|
||||||
amount: double.parse(selfApplyPercent.toString()).toString(),
|
amount: homeViewModel.selfApplyPercent.toString(),
|
||||||
circularProgressIndicatorWidth: 176,
|
circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
circularProgressIndicatorHeight: 176,
|
||||||
),
|
),
|
||||||
//SizedBox(width: 106),
|
|
||||||
// ProgressBarColumn(
|
|
||||||
// text: AppStrings.contracting,
|
|
||||||
// value: double.parse(homeResponse.contracting ?? '0'),
|
|
||||||
// amount: homeResponse.contracting ?? '0',
|
|
||||||
// circularProgressIndicatorWidth: 176,
|
|
||||||
// circularProgressIndicatorHeight: 176,
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _firstTenderCardsRow(
|
Widget _firstTenderCardsRow(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
|
||||||
HomeViewModel homeViewModel,
|
HomeViewModel homeViewModel,
|
||||||
) {
|
) {
|
||||||
return Row(
|
return Row(
|
||||||
@@ -143,16 +130,16 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: TenderCard(
|
child: TenderCard(
|
||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: 'assets/icons/arrows.svg',
|
iconPath: AssetsManager.arrows,
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount:
|
amount:
|
||||||
tenderApprovalsStateResponse.data!.submittedTenders.toString(),
|
homeViewModel
|
||||||
// tenderApprovalsStateResponse
|
.tenderApprovalsStateResponse!
|
||||||
// .data!
|
.data!
|
||||||
// .approvalsBySubmission!
|
.submittedTenders
|
||||||
// .selfApply
|
.toString(),
|
||||||
// .toString(),
|
|
||||||
textColor: Color(0xFF0164FF),
|
textColor: AppColors.mainBlue,
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
height: 148,
|
height: 148,
|
||||||
@@ -168,7 +155,7 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
iconPath: AssetsManager.approve,
|
iconPath: AssetsManager.approve,
|
||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: '0',
|
amount: '0',
|
||||||
textColor: Color(0xFF24848E),
|
textColor: AppColors.jellyBean,
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
height: 148,
|
height: 148,
|
||||||
@@ -180,10 +167,10 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
TenderCard(
|
TenderCard(
|
||||||
backgroundColor: AppColors.orange10,
|
backgroundColor: AppColors.orange10,
|
||||||
iconPath: 'assets/icons/shield.svg',
|
iconPath: AssetsManager.shield,
|
||||||
title: AppStrings.tenderValue,
|
title: AppStrings.tenderValue,
|
||||||
amount: '3',
|
amount: '3',
|
||||||
textColor: Color(0xFFE5821E),
|
textColor: AppColors.orange,
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
height: 148,
|
height: 148,
|
||||||
@@ -195,7 +182,7 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
iconPath: AssetsManager.thumbLike,
|
iconPath: AssetsManager.thumbLike,
|
||||||
title: AppStrings.likedTenders,
|
title: AppStrings.likedTenders,
|
||||||
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
|
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
|
||||||
textColor: Color(0xFF9E9E9E),
|
textColor: AppColors.grey80,
|
||||||
enableTap: false,
|
enableTap: false,
|
||||||
width: 178,
|
width: 178,
|
||||||
height: 148,
|
height: 148,
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (homeViewModel.tenderApprovalsStateResponse != null &&
|
if (homeViewModel.tenderApprovalsStateResponse != null &&
|
||||||
homeViewModel.data != null) {
|
homeViewModel.data != null &&
|
||||||
|
homeViewModel.feedbackStats != null) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -39,7 +40,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
// SizedBox(height: 18.0.h()),
|
// SizedBox(height: 18.0.h()),
|
||||||
// NotificationCard(),
|
// NotificationCard(),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_progressBarsRow(homeViewModel.tenderApprovalsStateResponse!),
|
_progressBarsRow(homeViewModel),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_firstTenderCardsRow(
|
_firstTenderCardsRow(
|
||||||
context,
|
context,
|
||||||
@@ -62,17 +63,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow(
|
Widget _progressBarsRow(HomeViewModel homeViewModel) {
|
||||||
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
|
||||||
) {
|
|
||||||
final partnership =
|
|
||||||
tenderApprovalsStateResponse.data!.partnershipCount ?? 0;
|
|
||||||
final selfApply = tenderApprovalsStateResponse.data!.selfApplyCount ?? 0;
|
|
||||||
final total = (partnership + selfApply);
|
|
||||||
|
|
||||||
final partnershipPercent = total > 0 ? (partnership / total) * 100 : 0;
|
|
||||||
final selfApplyPercent = total > 0 ? (selfApply / total) * 100 : 0;
|
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -81,22 +72,17 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
SizedBox(width: 20.0.w()),
|
SizedBox(width: 20.0.w()),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: double.parse('$partnershipPercent'),
|
value: homeViewModel.partnershipPercent,
|
||||||
amount: double.parse('$partnershipPercent').toString(),
|
amount: homeViewModel.partnershipPercent.toString(),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: double.parse(selfApplyPercent.toString()),
|
value: homeViewModel.selfApplyPercent,
|
||||||
amount: double.parse(selfApplyPercent.toString()).toString(),
|
amount: homeViewModel.selfApplyPercent.toString(),
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.0.w()),
|
SizedBox(width: 20.0.w()),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
// ProgressBarColumn(
|
|
||||||
// text: AppStrings.contracting,
|
|
||||||
// value: double.parse(tenderApprovalsStateResponse.data.contracting ?? '0'),
|
|
||||||
// amount: tenderApprovalsStateResponse.data.contracting ?? '0',
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -117,12 +103,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount:
|
amount:
|
||||||
tenderApprovalsStateResponse.data!.submittedTenders.toString(),
|
tenderApprovalsStateResponse.data!.submittedTenders.toString(),
|
||||||
// tenderApprovalsStateResponse
|
textColor: AppColors.mainBlue,
|
||||||
// .data!
|
|
||||||
// .approvalsBySubmission!
|
|
||||||
// .selfApply
|
|
||||||
// .toString(),
|
|
||||||
textColor: Color(0xFF0164FF),
|
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
YourTendersRouteData().push(context);
|
YourTendersRouteData().push(context);
|
||||||
@@ -134,7 +115,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: '0',
|
amount: '0',
|
||||||
|
|
||||||
textColor: Color(0xFF24848E),
|
textColor: AppColors.jellyBean,
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
YourTendersRouteData().push(context);
|
YourTendersRouteData().push(context);
|
||||||
@@ -157,7 +138,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
iconPath: AssetsManager.shield,
|
iconPath: AssetsManager.shield,
|
||||||
title: AppStrings.tenderValue,
|
title: AppStrings.tenderValue,
|
||||||
amount: '3',
|
amount: '3',
|
||||||
textColor: Color(0xFFE5821E),
|
textColor: AppColors.orange,
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
),
|
),
|
||||||
@@ -166,7 +147,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
iconPath: AssetsManager.thumbLike,
|
iconPath: AssetsManager.thumbLike,
|
||||||
title: AppStrings.likedTenders,
|
title: AppStrings.likedTenders,
|
||||||
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
|
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
|
||||||
textColor: Color(0xFF9E9E9E),
|
textColor: AppColors.grey80,
|
||||||
enableTap: false,
|
enableTap: false,
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -81,58 +81,56 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
return Center(child: Text(homeViewModel.errorMessage!));
|
return Center(child: Text(homeViewModel.errorMessage!));
|
||||||
}
|
}
|
||||||
|
|
||||||
return SingleChildScrollView(
|
if (homeViewModel.tenderApprovalsStateResponse != null &&
|
||||||
child: Padding(
|
homeViewModel.data != null &&
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
homeViewModel.feedbackStats != null) {
|
||||||
24.0.w(),
|
return SingleChildScrollView(
|
||||||
24.0.h(),
|
child: Padding(
|
||||||
24.0.w(),
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
24.0.h(),
|
24.0.w(),
|
||||||
|
24.0.h(),
|
||||||
|
24.0.w(),
|
||||||
|
24.0.h(),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// NotificationCard(),
|
||||||
|
SizedBox(height: 40.0.h()),
|
||||||
|
_progressBarsRow(homeViewModel),
|
||||||
|
SizedBox(height: 32.0.h()),
|
||||||
|
_firstTenderCardsRow(
|
||||||
|
context,
|
||||||
|
homeViewModel.tenderApprovalsStateResponse!,
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.0.h()),
|
||||||
|
_secondTenderCardsRow(homeViewModel),
|
||||||
|
SizedBox(height: 32.0.h()),
|
||||||
|
_yourTenderText(homeViewModel),
|
||||||
|
SizedBox(height: 8.0.h()),
|
||||||
|
_bottomListView(homeViewModel),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
);
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
}
|
||||||
children: [
|
return const Center(
|
||||||
// NotificationCard(),
|
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||||
SizedBox(height: 40.0.h()),
|
|
||||||
_progressBarsRow(homeViewModel.tenderApprovalsStateResponse!),
|
|
||||||
SizedBox(height: 32.0.h()),
|
|
||||||
_firstTenderCardsRow(
|
|
||||||
context,
|
|
||||||
homeViewModel.tenderApprovalsStateResponse!,
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.0.h()),
|
|
||||||
_secondTenderCardsRow(homeViewModel),
|
|
||||||
SizedBox(height: 32.0.h()),
|
|
||||||
_yourTenderText(homeViewModel),
|
|
||||||
SizedBox(height: 8.0.h()),
|
|
||||||
_bottomListView(homeViewModel),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow(
|
Widget _progressBarsRow(HomeViewModel homeViewModel) {
|
||||||
TenderApprovalsStateResponse tenderApprovalsStateResponse,
|
|
||||||
) {
|
|
||||||
final partnership =
|
|
||||||
tenderApprovalsStateResponse.data!.partnershipCount ?? 0;
|
|
||||||
final selfApply = tenderApprovalsStateResponse.data!.selfApplyCount ?? 0;
|
|
||||||
final total = (partnership + selfApply);
|
|
||||||
|
|
||||||
final partnershipPercent = total > 0 ? (partnership / total) * 100 : 0;
|
|
||||||
final selfApplyPercent = total > 0 ? (selfApply / total) * 100 : 0;
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Spacer(),
|
Spacer(),
|
||||||
SizedBox(width: 20.0.w()),
|
SizedBox(width: 20.0.w()),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: double.parse('$partnershipPercent'),
|
value: homeViewModel.partnershipPercent,
|
||||||
amount: double.parse('$partnershipPercent').toString(),
|
amount: homeViewModel.partnershipPercent.toString(),
|
||||||
circularProgressIndicatorWidth: 176.0,
|
circularProgressIndicatorWidth: 176.0,
|
||||||
circularProgressIndicatorHeight: 176.0,
|
circularProgressIndicatorHeight: 176.0,
|
||||||
strokeWidth: 8.0,
|
strokeWidth: 8.0,
|
||||||
@@ -140,22 +138,14 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: double.parse(selfApplyPercent.toString()),
|
value: homeViewModel.selfApplyPercent,
|
||||||
amount: double.parse(selfApplyPercent.toString()).toString(),
|
amount: homeViewModel.selfApplyPercent.toString(),
|
||||||
circularProgressIndicatorWidth: 176.0,
|
circularProgressIndicatorWidth: 176.0,
|
||||||
circularProgressIndicatorHeight: 176.0,
|
circularProgressIndicatorHeight: 176.0,
|
||||||
strokeWidth: 8.0,
|
strokeWidth: 8.0,
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.0.w()),
|
SizedBox(width: 20.0.w()),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
// ProgressBarColumn(
|
|
||||||
// text: AppStrings.contracting,
|
|
||||||
// value: double.parse(homeResponse.contracting ?? '0'),
|
|
||||||
// amount: homeResponse.contracting ?? '0',
|
|
||||||
// circularProgressIndicatorWidth: 176.0,
|
|
||||||
// circularProgressIndicatorHeight: 176.0,
|
|
||||||
// strokeWidth: 8.0,
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -170,16 +160,12 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: TenderCard(
|
child: TenderCard(
|
||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: 'assets/icons/arrows.svg',
|
iconPath: AssetsManager.arrows,
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount:
|
amount:
|
||||||
tenderApprovalsStateResponse.data!.submittedTenders.toString(),
|
tenderApprovalsStateResponse.data!.submittedTenders.toString(),
|
||||||
// tenderApprovalsStateResponse
|
|
||||||
// .data!
|
textColor: AppColors.mainBlue,
|
||||||
// .approvalsBySubmission!
|
|
||||||
// .selfApply
|
|
||||||
// .toString(),
|
|
||||||
textColor: Color(0xFF0164FF),
|
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 148,
|
height: 148,
|
||||||
@@ -196,7 +182,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: '0',
|
amount: '0',
|
||||||
|
|
||||||
textColor: Color(0xFF24848E),
|
textColor: AppColors.jellyBean,
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 148,
|
height: 148,
|
||||||
@@ -217,10 +203,10 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: TenderCard(
|
child: TenderCard(
|
||||||
backgroundColor: AppColors.orange10,
|
backgroundColor: AppColors.orange10,
|
||||||
iconPath: 'assets/icons/shield.svg',
|
iconPath: AssetsManager.shield,
|
||||||
title: AppStrings.tenderValue,
|
title: AppStrings.tenderValue,
|
||||||
amount: '3',
|
amount: '3',
|
||||||
textColor: Color(0xFFE5821E),
|
textColor: AppColors.orange,
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 148,
|
height: 148,
|
||||||
@@ -234,7 +220,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
iconPath: AssetsManager.thumbLike,
|
iconPath: AssetsManager.thumbLike,
|
||||||
title: AppStrings.likedTenders,
|
title: AppStrings.likedTenders,
|
||||||
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
|
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
|
||||||
textColor: Color(0xFF9E9E9E),
|
textColor: AppColors.grey80,
|
||||||
enableTap: false,
|
enableTap: false,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 148,
|
height: 148,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class _ProgressBarColumnState extends State<ProgressBarColumn>
|
|||||||
animation: _animation,
|
animation: _animation,
|
||||||
builder:
|
builder:
|
||||||
(context, child) => CircularProgressIndicator(
|
(context, child) => CircularProgressIndicator(
|
||||||
backgroundColor: Color(0xFFE1E1E1),
|
backgroundColor: AppColors.grey10,
|
||||||
strokeCap: StrokeCap.round,
|
strokeCap: StrokeCap.round,
|
||||||
strokeWidth: widget.strokeWidth ?? 6.0,
|
strokeWidth: widget.strokeWidth ?? 6.0,
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(AppColors.jellyBean),
|
valueColor: AlwaysStoppedAnimation<Color>(AppColors.jellyBean),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
import '../../core/constants/assets.dart';
|
import '../../core/constants/assets.dart';
|
||||||
|
import '../../core/theme/colors.dart';
|
||||||
import '../../core/utils/size_config.dart';
|
import '../../core/utils/size_config.dart';
|
||||||
|
|
||||||
class TenderCard extends StatelessWidget {
|
class TenderCard extends StatelessWidget {
|
||||||
@@ -50,7 +51,7 @@ class TenderCard extends StatelessWidget {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16.0.sp(),
|
fontSize: 16.0.sp(),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Color(0xFF777777),
|
color: AppColors.grey80,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ class TendersListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
// SizedBox(height: 18.0.h()),
|
|
||||||
TenderCardProgressBar(),
|
TenderCardProgressBar(),
|
||||||
SizedBox(height: 15.0.h()),
|
SizedBox(height: 15.0.h()),
|
||||||
|
|
||||||
@@ -123,23 +122,6 @@ class TendersListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
// Container(
|
|
||||||
// width: 96.0.w(),
|
|
||||||
// height: 24.0.h(),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: AppColors.grey30,
|
|
||||||
// borderRadius: BorderRadius.circular(88),
|
|
||||||
// ),
|
|
||||||
// alignment: Alignment.center,
|
|
||||||
// child: Text(
|
|
||||||
// 'tender.type',
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 12.0.sp(),
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// color: AppColors.grey60,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -207,7 +207,10 @@ class TenderActionButtonsRow extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
viewModel.feedback(tenderId: tender.id!, feedbackType: 'dislike');
|
viewModel.toogleFeedback(
|
||||||
|
tenderId: tender.id!,
|
||||||
|
feedbackType: 'dislike',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -251,7 +254,7 @@ class TenderActionButtonsRow extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
viewModel.feedback(tenderId: tender.id!, feedbackType: 'like');
|
viewModel.toogleFeedback(tenderId: tender.id!, feedbackType: 'like');
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user