refactor home
This commit is contained in:
@@ -31,7 +31,8 @@ class MobileHomePage extends StatelessWidget {
|
||||
}
|
||||
|
||||
if (homeViewModel.tenderApprovalsStateResponse != null &&
|
||||
homeViewModel.data != null) {
|
||||
homeViewModel.data != null &&
|
||||
homeViewModel.feedbackStats != null) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -39,7 +40,7 @@ class MobileHomePage extends StatelessWidget {
|
||||
// SizedBox(height: 18.0.h()),
|
||||
// NotificationCard(),
|
||||
SizedBox(height: 32.0.h()),
|
||||
_progressBarsRow(homeViewModel.tenderApprovalsStateResponse!),
|
||||
_progressBarsRow(homeViewModel),
|
||||
SizedBox(height: 32.0.h()),
|
||||
_firstTenderCardsRow(
|
||||
context,
|
||||
@@ -62,17 +63,7 @@ class MobileHomePage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _progressBarsRow(
|
||||
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;
|
||||
|
||||
Widget _progressBarsRow(HomeViewModel homeViewModel) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||
child: Row(
|
||||
@@ -81,22 +72,17 @@ class MobileHomePage extends StatelessWidget {
|
||||
SizedBox(width: 20.0.w()),
|
||||
ProgressBarColumn(
|
||||
text: AppStrings.partnership,
|
||||
value: double.parse('$partnershipPercent'),
|
||||
amount: double.parse('$partnershipPercent').toString(),
|
||||
value: homeViewModel.partnershipPercent,
|
||||
amount: homeViewModel.partnershipPercent.toString(),
|
||||
),
|
||||
Spacer(),
|
||||
ProgressBarColumn(
|
||||
text: AppStrings.selfApply,
|
||||
value: double.parse(selfApplyPercent.toString()),
|
||||
amount: double.parse(selfApplyPercent.toString()).toString(),
|
||||
value: homeViewModel.selfApplyPercent,
|
||||
amount: homeViewModel.selfApplyPercent.toString(),
|
||||
),
|
||||
SizedBox(width: 20.0.w()),
|
||||
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,
|
||||
amount:
|
||||
tenderApprovalsStateResponse.data!.submittedTenders.toString(),
|
||||
// tenderApprovalsStateResponse
|
||||
// .data!
|
||||
// .approvalsBySubmission!
|
||||
// .selfApply
|
||||
// .toString(),
|
||||
textColor: Color(0xFF0164FF),
|
||||
textColor: AppColors.mainBlue,
|
||||
enableTap: true,
|
||||
onTap: () {
|
||||
YourTendersRouteData().push(context);
|
||||
@@ -134,7 +115,7 @@ class MobileHomePage extends StatelessWidget {
|
||||
title: AppStrings.approvedTenders,
|
||||
amount: '0',
|
||||
|
||||
textColor: Color(0xFF24848E),
|
||||
textColor: AppColors.jellyBean,
|
||||
enableTap: true,
|
||||
onTap: () {
|
||||
YourTendersRouteData().push(context);
|
||||
@@ -157,7 +138,7 @@ class MobileHomePage extends StatelessWidget {
|
||||
iconPath: AssetsManager.shield,
|
||||
title: AppStrings.tenderValue,
|
||||
amount: '3',
|
||||
textColor: Color(0xFFE5821E),
|
||||
textColor: AppColors.orange,
|
||||
enableTap: true,
|
||||
onTap: () {},
|
||||
),
|
||||
@@ -166,7 +147,7 @@ class MobileHomePage extends StatelessWidget {
|
||||
iconPath: AssetsManager.thumbLike,
|
||||
title: AppStrings.likedTenders,
|
||||
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
|
||||
textColor: Color(0xFF9E9E9E),
|
||||
textColor: AppColors.grey80,
|
||||
enableTap: false,
|
||||
onTap: () {},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user