Merge pull request 'safearea' (#160) from safearea into main

Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/160
This commit is contained in:
a.ghabeli
2025-09-24 13:51:47 +03:30
29 changed files with 1267 additions and 1178 deletions
+35 -13
View File
@@ -3,6 +3,7 @@ import 'package:tm_app/core/utils/app_toast.dart';
import 'package:tm_app/core/utils/result.dart';
import 'package:tm_app/data/repositories/notification_repository.dart';
import 'package:tm_app/data/services/model/notification__response/notification_response_model.dart';
import 'package:tm_app/views/notification/strings/notification_strings.dart';
class NotificationViewModel with ChangeNotifier {
final NotificationsRepository _repository;
@@ -38,9 +39,16 @@ class NotificationViewModel with ChangeNotifier {
_unreadNotificationResponse;
bool get isUnreadLoading => _isUnreadLoading;
bool _isMoreLoading = false;
bool get isMoreLoading => _isMoreLoading;
/// Fetch notifications
Future<void> getNotifications({int page = 1, bool isMobile = false}) async {
_isLoading = true;
if (isMobile && page > 1) {
_isMoreLoading = true; // 👈 لودینگ فقط برای پیج بعدی
} else {
_isLoading = true; // 👈 لودینگ عادی (اولین بار یا رفرش)
}
notifyListeners();
final int offset = _pageSize * page;
@@ -79,6 +87,7 @@ class NotificationViewModel with ChangeNotifier {
}
_isLoading = false;
_isMoreLoading = false;
notifyListeners();
}
@@ -98,11 +107,17 @@ class NotificationViewModel with ChangeNotifier {
final result = await _repository.markAllAsRead();
if (!context.mounted) {
return;
}
switch (result) {
case Ok<Map<String, dynamic>>():
final response = result.value;
final success = response['success'] as bool? ?? false;
final message = response['message'] as String? ?? 'Unknown response';
final message =
response['message'] as String? ??
NotificationStrings.unknownResponse;
if (success) {
if (_notificationResponseModel?.data?.notifications != null) {
@@ -118,21 +133,28 @@ class NotificationViewModel with ChangeNotifier {
);
}
await getNotifications(page: currentPage, );
await getNotifications(page: currentPage);
await getUnreadNotifications();
// toast success
AppToast.success(context, 'All notifications marked as read.');
if (context.mounted) {
AppToast.success(
context,
NotificationStrings.allNotificationMarkedAsRead,
);
}
} else {
_errorMessage = message;
AppToast.error(context, message);
if (context.mounted) {
AppToast.error(context, message);
}
}
break;
case Error<Map<String, dynamic>>():
_errorMessage = result.error.toString();
AppToast.error(context, _errorMessage!);
if (context.mounted) {
AppToast.error(context, _errorMessage!);
}
break;
}
@@ -146,15 +168,15 @@ class NotificationViewModel with ChangeNotifier {
final difference = now.difference(createdAt);
if (difference.inMinutes < 1) {
return 'Now';
return NotificationStrings.now;
} else if (difference.inMinutes < 60) {
return '${difference.inMinutes} Min ';
return '${difference.inMinutes} ${NotificationStrings.min} ';
} else if (difference.inHours < 24) {
return '${difference.inHours} Hour ';
return '${difference.inHours} ${NotificationStrings.hour} ';
} else if (difference.inDays == 1) {
return 'Yesterday';
return NotificationStrings.yesterday;
} else {
return '${difference.inDays} days ago';
return '${difference.inDays} ${NotificationStrings.daysAgo}';
}
}
@@ -18,215 +18,217 @@ class CompletionOfDocumentsMobilePage extends StatelessWidget {
context: context,
title: CompletionOfDocumentsStrings.completionOfDocuments,
),
body: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 12.0.h()),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
height: 24.0.h(),
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(4),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
CompletionOfDocumentsStrings.submissionDeadline,
style: TextStyle(
color: AppColors.textBlue,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
),
),
Text(
'2025-06-15',
style: TextStyle(
color: AppColors.grey80,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
),
),
],
),
),
SizedBox(height: 12.0.h()),
Container(
height: 58.0.h(),
width: double.infinity,
padding: EdgeInsets.symmetric(
horizontal: 12.0.w(),
vertical: 8.0.h(),
),
decoration: BoxDecoration(
border: Border.all(color: AppColors.orange10),
borderRadius: BorderRadius.circular(8),
color: AppColors.orange0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
'Match with your profile',
style: TextStyle(
fontSize: 12.0.sp(),
color: AppColors.grey80,
fontWeight: FontWeight.w400,
),
),
const Spacer(),
Text(
'75%',
style: TextStyle(
fontSize: 12.0.sp(),
color: AppColors.cyanTeal,
fontWeight: FontWeight.w600,
),
),
],
),
SizedBox(height: 4.0.h()),
Row(
children: [
Expanded(
child: LinearProgressIndicator(
value: 0.75,
backgroundColor: const Color(0xFFE0E0E0),
color: AppColors.cyanTeal,
minHeight: 6,
borderRadius: BorderRadius.circular(10),
),
),
],
),
],
),
),
SizedBox(height: 16.0.h()),
_docCard(
title: 'Company Registration Certificate',
subtitle: 'Legal document proving business registration',
status: 'Completed',
statusColor: AppColors.green30,
statusBackgroundColor: AppColors.green10,
backgroundColor: AppColors.primary10,
borderSideColor: AppColors.primary20,
),
_docCard(
title: 'Tax Compliance Certificate',
subtitle: 'Proof of tax registration and compliance',
status: 'Completed',
statusColor: AppColors.green30,
statusBackgroundColor: AppColors.green10,
backgroundColor: AppColors.primary10,
borderSideColor: AppColors.primary30,
),
_docCard(
title: 'Technical Proposal',
subtitle: 'Detailed technical solution for the tender',
status: 'Incomplete',
statusColor: AppColors.red20,
statusBackgroundColor: AppColors.red10,
backgroundColor: AppColors.red0,
tag: 'Self apply',
tagColor: AppColors.green30,
borderSideColor: AppColors.red10,
tagBackgroundColor: AppColors.green20,
),
_docCard(
title: 'Financial Proposal',
subtitle: 'Detailed cost breakdown and pricing',
status: 'Incomplete',
statusColor: AppColors.red20,
statusBackgroundColor: AppColors.red10,
backgroundColor: AppColors.red0,
tag: 'Partnership',
tagColor: AppColors.purple,
borderSideColor: AppColors.red10,
tagBackgroundColor: AppColors.purpleLight,
),
_docCard(
title: 'Financial Proposal',
subtitle: 'Detailed cost breakdown and pricing',
status: 'Incomplete',
statusColor: AppColors.red20,
statusBackgroundColor: AppColors.red10,
backgroundColor: AppColors.red0,
borderSideColor: AppColors.red10,
),
SizedBox(height: 16.0.h()),
Text(
CompletionOfDocumentsStrings.setDeadline,
style: TextStyle(
fontSize: 16.0.sp(),
color: AppColors.grey80,
fontWeight: FontWeight.w600,
),
),
SizedBox(height: 8.0.h()),
Container(
height: 48.0.h(),
padding: EdgeInsets.symmetric(horizontal: 12.0.w()),
decoration: BoxDecoration(
border: Border.all(color: AppColors.grey40),
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'2025/04/10',
style: TextStyle(
fontSize: 16.0.sp(),
fontWeight: FontWeight.w700,
color: AppColors.grey60,
),
),
SvgPicture.asset(
AssetsManager.calendar,
height: 24.0.h(),
width: 24.0.w(),
),
],
),
),
SizedBox(height: 16.0.h()),
Container(
padding: const EdgeInsets.all(12),
height: 100.0.h(),
decoration: BoxDecoration(
border: Border.all(color: AppColors.borderColor),
borderRadius: BorderRadius.circular(8),
color: AppColors.grey0,
),
child: TextField(
maxLines: null,
decoration: const InputDecoration.collapsed(
hintText: CompletionOfDocumentsStrings.note,
body: SafeArea(
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 12.0.h()),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
height: 24.0.h(),
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(4),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
CompletionOfDocumentsStrings.submissionDeadline,
style: TextStyle(
color: AppColors.textBlue,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
),
),
Text(
'2025-06-15',
style: TextStyle(
color: AppColors.grey80,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
),
),
],
),
),
SizedBox(height: 12.0.h()),
Container(
height: 58.0.h(),
width: double.infinity,
padding: EdgeInsets.symmetric(
horizontal: 12.0.w(),
vertical: 8.0.h(),
),
decoration: BoxDecoration(
border: Border.all(color: AppColors.orange10),
borderRadius: BorderRadius.circular(8),
color: AppColors.orange0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
'Match with your profile',
style: TextStyle(
fontSize: 12.0.sp(),
color: AppColors.grey80,
fontWeight: FontWeight.w400,
),
),
const Spacer(),
Text(
'75%',
style: TextStyle(
fontSize: 12.0.sp(),
color: AppColors.cyanTeal,
fontWeight: FontWeight.w600,
),
),
],
),
SizedBox(height: 4.0.h()),
Row(
children: [
Expanded(
child: LinearProgressIndicator(
value: 0.75,
backgroundColor: const Color(0xFFE0E0E0),
color: AppColors.cyanTeal,
minHeight: 6,
borderRadius: BorderRadius.circular(10),
),
),
],
),
],
),
),
SizedBox(height: 16.0.h()),
_docCard(
title: 'Company Registration Certificate',
subtitle: 'Legal document proving business registration',
status: 'Completed',
statusColor: AppColors.green30,
statusBackgroundColor: AppColors.green10,
backgroundColor: AppColors.primary10,
borderSideColor: AppColors.primary20,
),
_docCard(
title: 'Tax Compliance Certificate',
subtitle: 'Proof of tax registration and compliance',
status: 'Completed',
statusColor: AppColors.green30,
statusBackgroundColor: AppColors.green10,
backgroundColor: AppColors.primary10,
borderSideColor: AppColors.primary30,
),
_docCard(
title: 'Technical Proposal',
subtitle: 'Detailed technical solution for the tender',
status: 'Incomplete',
statusColor: AppColors.red20,
statusBackgroundColor: AppColors.red10,
backgroundColor: AppColors.red0,
tag: 'Self apply',
tagColor: AppColors.green30,
borderSideColor: AppColors.red10,
tagBackgroundColor: AppColors.green20,
),
_docCard(
title: 'Financial Proposal',
subtitle: 'Detailed cost breakdown and pricing',
status: 'Incomplete',
statusColor: AppColors.red20,
statusBackgroundColor: AppColors.red10,
backgroundColor: AppColors.red0,
tag: 'Partnership',
tagColor: AppColors.purple,
borderSideColor: AppColors.red10,
tagBackgroundColor: AppColors.purpleLight,
),
_docCard(
title: 'Financial Proposal',
subtitle: 'Detailed cost breakdown and pricing',
status: 'Incomplete',
statusColor: AppColors.red20,
statusBackgroundColor: AppColors.red10,
backgroundColor: AppColors.red0,
borderSideColor: AppColors.red10,
),
SizedBox(height: 16.0.h()),
Text(
CompletionOfDocumentsStrings.setDeadline,
style: TextStyle(
fontSize: 16.0.sp(),
color: AppColors.grey60,
fontWeight: FontWeight.w400,
color: AppColors.grey80,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(height: 24.0.h()),
BaseButton(
isEnabled: true,
onPressed: () {},
text: CompletionOfDocumentsStrings.submitForCompletion,
textColor: AppColors.textBlue,
backgroundColor: AppColors.primary30,
),
],
SizedBox(height: 8.0.h()),
Container(
height: 48.0.h(),
padding: EdgeInsets.symmetric(horizontal: 12.0.w()),
decoration: BoxDecoration(
border: Border.all(color: AppColors.grey40),
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'2025/04/10',
style: TextStyle(
fontSize: 16.0.sp(),
fontWeight: FontWeight.w700,
color: AppColors.grey60,
),
),
SvgPicture.asset(
AssetsManager.calendar,
height: 24.0.h(),
width: 24.0.w(),
),
],
),
),
SizedBox(height: 16.0.h()),
Container(
padding: const EdgeInsets.all(12),
height: 100.0.h(),
decoration: BoxDecoration(
border: Border.all(color: AppColors.borderColor),
borderRadius: BorderRadius.circular(8),
color: AppColors.grey0,
),
child: TextField(
maxLines: null,
decoration: const InputDecoration.collapsed(
hintText: CompletionOfDocumentsStrings.note,
),
style: TextStyle(
fontSize: 16.0.sp(),
color: AppColors.grey60,
fontWeight: FontWeight.w400,
),
),
),
SizedBox(height: 24.0.h()),
BaseButton(
isEnabled: true,
onPressed: () {},
text: CompletionOfDocumentsStrings.submitForCompletion,
textColor: AppColors.textBlue,
backgroundColor: AppColors.primary30,
),
],
),
),
),
);
+35 -33
View File
@@ -96,44 +96,46 @@ class _TenderDetailDesktopPageState extends State<TenderDetailDesktopPage> {
return const Center(child: Text(TenderDetailsStrings.tenderNoData));
}
return Column(
children: [
const DesktopNavigationWidget(
currentIndex: 1, // Home index
),
Expanded(
child: SingleChildScrollView(
child: Center(
child: SizedBox(
width: 740,
child: Padding(
padding: const EdgeInsets.all(32.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TabletDesktopAppbar(
title: TenderDetailsStrings.tenderDetailTitle,
),
SizedBox(height: 32.0.h()),
TenderDetailHeader(
isScreenBig: true,
detail: detail,
),
SizedBox(height: 32.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(
isScreenBig: true,
detail: detail,
),
],
return SafeArea(
child: Column(
children: [
const DesktopNavigationWidget(
currentIndex: 1, // Home index
),
Expanded(
child: SingleChildScrollView(
child: Center(
child: SizedBox(
width: 740,
child: Padding(
padding: const EdgeInsets.all(32.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TabletDesktopAppbar(
title: TenderDetailsStrings.tenderDetailTitle,
),
SizedBox(height: 32.0.h()),
TenderDetailHeader(
isScreenBig: true,
detail: detail,
),
SizedBox(height: 32.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(
isScreenBig: true,
detail: detail,
),
],
),
),
),
),
),
),
),
],
],
),
);
},
),
+17 -15
View File
@@ -102,21 +102,23 @@ class _TenderDetailMobilePageState extends State<TenderDetailMobilePage> {
);
}
return SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.0.w(),
vertical: 16.0.h(),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TenderDetailHeader(isScreenBig: false, detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(isScreenBig: false, detail: detail),
],
return SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.0.w(),
vertical: 16.0.h(),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TenderDetailHeader(isScreenBig: false, detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(isScreenBig: false, detail: detail),
],
),
),
),
);
+21 -19
View File
@@ -104,26 +104,28 @@ class _TenderDetailTabletPageState extends State<TenderDetailTabletPage> {
if (detail == null) {
return const Center(child: Text(TenderDetailsStrings.tenderNoData));
}
return SingleChildScrollView(
child: Center(
child: SizedBox(
width: 768,
return SafeArea(
child: SingleChildScrollView(
child: Center(
child: SizedBox(
width: 768,
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TabletDesktopAppbar(
title: TenderDetailsStrings.tenderDetailTitle,
),
SizedBox(height: 28.0.h()),
TenderDetailHeader(isScreenBig: true, detail: detail),
SizedBox(height: 28.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(isScreenBig: true, detail: detail),
],
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TabletDesktopAppbar(
title: TenderDetailsStrings.tenderDetailTitle,
),
SizedBox(height: 28.0.h()),
TenderDetailHeader(isScreenBig: true, detail: detail),
SizedBox(height: 28.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(isScreenBig: true, detail: detail),
],
),
),
),
),
@@ -23,55 +23,57 @@ class FinalCompletionOfDocumentsScreen extends StatelessWidget {
return Scaffold(
body: Consumer<FinalCompletionOfDocumentsViewModel>(
builder:
(context, viewModel, child) => Column(
children: [
const DesktopNavigationWidget(currentIndex: 1),
const SizedBox(height: 64.0),
Expanded(
child: SizedBox(
width: 740,
child: SingleChildScrollView(
child: Column(
children: [
const TabletDesktopAppbar(
title:
FinalCompletionOfDocumentsStrings
.completionOfDocuments,
),
SizedBox(height: 32.0.h()),
(context, viewModel, child) => SafeArea(
child: Column(
children: [
const DesktopNavigationWidget(currentIndex: 1),
const SizedBox(height: 64.0),
Expanded(
child: SizedBox(
width: 740,
child: SingleChildScrollView(
child: Column(
children: [
const TabletDesktopAppbar(
title:
FinalCompletionOfDocumentsStrings
.completionOfDocuments,
),
SizedBox(height: 32.0.h()),
const SizedBox(height: 32.0),
const CommentBox(),
const SizedBox(height: 32.0),
FormCard(viewModel: viewModel),
const SizedBox(height: 40.0),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
BaseButton(
isEnabled: true,
onPressed: () {},
width: 176,
backgroundColor: AppColors.primary10,
textColor: AppColors.mainBlue,
text: FinalCompletionOfDocumentsStrings.back,
),
const SizedBox(width: 16.0),
BaseButton(
isEnabled: true,
onPressed: () {},
width: 176,
text: FinalCompletionOfDocumentsStrings.next,
),
],
),
const SizedBox(height: 35.0),
],
const SizedBox(height: 32.0),
const CommentBox(),
const SizedBox(height: 32.0),
FormCard(viewModel: viewModel),
const SizedBox(height: 40.0),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
BaseButton(
isEnabled: true,
onPressed: () {},
width: 176,
backgroundColor: AppColors.primary10,
textColor: AppColors.mainBlue,
text: FinalCompletionOfDocumentsStrings.back,
),
const SizedBox(width: 16.0),
BaseButton(
isEnabled: true,
onPressed: () {},
width: 176,
text: FinalCompletionOfDocumentsStrings.next,
),
],
),
const SizedBox(height: 35.0),
],
),
),
),
),
),
],
],
),
),
),
);
+22 -20
View File
@@ -39,26 +39,28 @@ class DesktopHomePage extends StatelessWidget {
if (homeViewModel.tenderApprovalsStateResponse != null &&
homeViewModel.data != null &&
homeViewModel.feedbackStats != null) {
return SingleChildScrollView(
child: SizedBox(
width: 780,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 55),
// SizedBox(width: 780, child: NotificationCard()),
const SizedBox(height: 40.0),
_progressBarsRow(homeViewModel),
SizedBox(height: 32.0.h()),
Padding(
padding: EdgeInsets.symmetric(horizontal: 15.0.w()),
child: _firstTenderCardsRow(context, homeViewModel),
),
SizedBox(height: 32.0.h()),
_yourTenderText(homeViewModel),
SizedBox(height: 8.0.h()),
_bottomListView(homeViewModel),
],
return SafeArea(
child: SingleChildScrollView(
child: SizedBox(
width: 780,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 55),
// SizedBox(width: 780, child: NotificationCard()),
const SizedBox(height: 40.0),
_progressBarsRow(homeViewModel),
SizedBox(height: 32.0.h()),
Padding(
padding: EdgeInsets.symmetric(horizontal: 15.0.w()),
child: _firstTenderCardsRow(context, homeViewModel),
),
SizedBox(height: 32.0.h()),
_yourTenderText(homeViewModel),
SizedBox(height: 8.0.h()),
_bottomListView(homeViewModel),
],
),
),
),
);
+21 -19
View File
@@ -33,25 +33,27 @@ class MobileHomePage extends StatelessWidget {
if (homeViewModel.tenderApprovalsStateResponse != null &&
homeViewModel.data != null &&
homeViewModel.feedbackStats != null) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// SizedBox(height: 18.0.h()),
// NotificationCard(),
SizedBox(height: 32.0.h()),
_progressBarsRow(homeViewModel),
SizedBox(height: 32.0.h()),
_firstTenderCardsRow(
context,
homeViewModel.tenderApprovalsStateResponse!,
),
SizedBox(height: 8.0.h()),
_secondTenderCardsRow(homeViewModel, context),
SizedBox(height: 40.0.h()),
_yourTenderText(homeViewModel),
_bottomListView(homeViewModel),
],
return SafeArea(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// SizedBox(height: 18.0.h()),
// NotificationCard(),
SizedBox(height: 32.0.h()),
_progressBarsRow(homeViewModel),
SizedBox(height: 32.0.h()),
_firstTenderCardsRow(
context,
homeViewModel.tenderApprovalsStateResponse!,
),
SizedBox(height: 8.0.h()),
_secondTenderCardsRow(homeViewModel, context),
SizedBox(height: 40.0.h()),
_yourTenderText(homeViewModel),
_bottomListView(homeViewModel),
],
),
),
);
}
+20 -18
View File
@@ -50,24 +50,26 @@ class TabletHomePage extends StatelessWidget {
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, context),
SizedBox(height: 32.0.h()),
_yourTenderText(homeViewModel),
SizedBox(height: 8.0.h()),
_bottomListView(homeViewModel),
],
child: SafeArea(
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, context),
SizedBox(height: 32.0.h()),
_yourTenderText(homeViewModel),
SizedBox(height: 8.0.h()),
_bottomListView(homeViewModel),
],
),
),
),
);
@@ -59,71 +59,73 @@ class _LikedTendersDesktopPageState extends State<LikedTendersDesktopPage> {
key: scaffoldKey,
backgroundColor: AppColors.backgroundColor,
endDrawer: const LikeFiltersDrawer(),
body: Column(
children: [
const DesktopNavigationWidget(currentIndex: 1, haveFilter: true),
const SizedBox(height: 40),
SizedBox(
width: 740,
child: TabletDesktopAppbar(
title: LikedTendersStrings.likedTenders,
haveFilter: true,
onFilterPressed: () {
scaffoldKey.currentState?.openEndDrawer();
},
),
),
const SizedBox(height: 24),
Expanded(
child: SizedBox(
body: SafeArea(
child: Column(
children: [
const DesktopNavigationWidget(currentIndex: 1, haveFilter: true),
const SizedBox(height: 40),
SizedBox(
width: 740,
child: Consumer<LikedTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.feedback ?? []).isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
final feedback = viewModel.data?.data?.feedback ?? [];
if (feedback.isEmpty) {
return const Center(
child: Text(LikedTendersStrings.noLikedTenders),
);
}
final currentPage = viewModel.currentPage;
final totalPages = viewModel.data?.data?.meta?.pages ?? 1;
return Column(
children: [
_likedTendersList(feedback, viewModel),
SizedBox(height: 10.0.h()),
_likedTenersListPageControll(
context,
totalPages,
viewModel,
currentPage,
),
SizedBox(height: 30.0.h()),
],
);
child: TabletDesktopAppbar(
title: LikedTendersStrings.likedTenders,
haveFilter: true,
onFilterPressed: () {
scaffoldKey.currentState?.openEndDrawer();
},
),
),
),
],
const SizedBox(height: 24),
Expanded(
child: SizedBox(
width: 740,
child: Consumer<LikedTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.feedback ?? []).isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
final feedback = viewModel.data?.data?.feedback ?? [];
if (feedback.isEmpty) {
return const Center(
child: Text(LikedTendersStrings.noLikedTenders),
);
}
final currentPage = viewModel.currentPage;
final totalPages = viewModel.data?.data?.meta?.pages ?? 1;
return Column(
children: [
_likedTendersList(feedback, viewModel),
SizedBox(height: 10.0.h()),
_likedTenersListPageControll(
context,
totalPages,
viewModel,
currentPage,
),
SizedBox(height: 30.0.h()),
],
);
},
),
),
),
],
),
),
),
);
@@ -156,91 +156,93 @@ class _LikedTendersMobilePageState extends State<LikedTendersMobilePage> {
),
),
body: Column(
children: [
Expanded(
child: Consumer<LikedTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.feedback ?? []).isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
body: SafeArea(
child: Column(
children: [
Expanded(
child: Consumer<LikedTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.feedback ?? []).isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
final feedback = viewModel.data?.data?.feedback ?? [];
if (feedback.isEmpty) {
return const Center(
child: Text(LikedTendersStrings.noLikedTenders),
);
}
final itemCount =
feedback.length + (viewModel.isLoadingMore ? 1 : 0);
return ListView.builder(
controller: _scrollController,
padding: EdgeInsets.symmetric(
horizontal: 24.0.w(),
vertical: 15.0.h(),
),
);
}
itemCount: itemCount,
itemBuilder: (context, index) {
if (index < feedback.length) {
final item = feedback[index];
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
final feedback = viewModel.data?.data?.feedback ?? [];
if (feedback.isEmpty) {
return const Center(
child: Text(LikedTendersStrings.noLikedTenders),
);
}
final itemCount =
feedback.length + (viewModel.isLoadingMore ? 1 : 0);
return ListView.builder(
controller: _scrollController,
padding: EdgeInsets.symmetric(
horizontal: 24.0.w(),
vertical: 15.0.h(),
),
itemCount: itemCount,
itemBuilder: (context, index) {
if (index < feedback.length) {
final item = feedback[index];
return Padding(
padding: EdgeInsets.only(bottom: 20.0.h()),
child: Dismissible(
key: ValueKey(item.tenderId ?? index),
direction: DismissDirection.endToStart,
background: Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.symmetric(
horizontal: 20.0.w(),
return Padding(
padding: EdgeInsets.only(bottom: 20.0.h()),
child: Dismissible(
key: ValueKey(item.tenderId ?? index),
direction: DismissDirection.endToStart,
background: Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.symmetric(
horizontal: 20.0.w(),
),
child: SvgPicture.asset(
AssetsManager.trash,
width: 32.0.w(),
height: 32.0.h(),
),
),
child: SvgPicture.asset(
AssetsManager.trash,
width: 32.0.w(),
height: 32.0.h(),
onDismissed: (_) {
if (item.tenderId != null) {
viewModel.removeTenderById(item.tenderId!);
}
},
child: LikedListItem(tender: item.tender!),
),
);
} else {
return Padding(
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
child: Center(
child: SizedBox(
width: 24.0.w(),
height: 24.0.h(),
child: const CircularProgressIndicator(
color: AppColors.secondary50,
strokeWidth: 2,
),
),
),
onDismissed: (_) {
if (item.tenderId != null) {
viewModel.removeTenderById(item.tenderId!);
}
},
child: LikedListItem(tender: item.tender!),
),
);
} else {
return Padding(
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
child: Center(
child: SizedBox(
width: 24.0.w(),
height: 24.0.h(),
child: const CircularProgressIndicator(
color: AppColors.secondary50,
strokeWidth: 2,
),
),
),
);
}
},
);
},
);
}
},
);
},
),
),
),
],
],
),
),
),
);
@@ -63,79 +63,81 @@ class _LikedTendersTabletPageState extends State<LikedTendersTabletPage> {
backgroundColor: AppColors.backgroundColor,
appBar: tabletAppBar(title: LikedTendersStrings.likedTenders, key: key),
drawer: const TabletNavigationWidget(currentIndex: 1),
body: Center(
child: SizedBox(
width: 720,
child: Column(
children: [
TabletDesktopAppbar(
title: LikedTendersStrings.likedTenders,
haveFilter: true,
onFilterPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: AppColors.backgroundColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
body: SafeArea(
child: Center(
child: SizedBox(
width: 720,
child: Column(
children: [
TabletDesktopAppbar(
title: LikedTendersStrings.likedTenders,
haveFilter: true,
onFilterPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: AppColors.backgroundColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
),
),
),
constraints: BoxConstraints(
maxWidth: MediaQuery.sizeOf(context).width,
maxHeight: MediaQuery.sizeOf(context).height,
),
builder: (context) => const LikeFiltersBottomSheet(),
);
},
),
Expanded(
child: Consumer<LikedTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.feedback ?? []).isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
final feedback = viewModel.data?.data?.feedback ?? [];
if (feedback.isEmpty) {
return const Center(
child: Text(LikedTendersStrings.noLikedTenders),
);
}
final currentPage = viewModel.currentPage;
final totalPages = viewModel.data?.data?.meta?.pages ?? 1;
return Column(
children: [
_likedTendersList(feedback, viewModel),
SizedBox(height: 10.0.h()),
_likeTendersListPagesControll(
context,
totalPages,
viewModel,
currentPage,
),
SizedBox(height: 30.0.h()),
],
constraints: BoxConstraints(
maxWidth: MediaQuery.sizeOf(context).width,
maxHeight: MediaQuery.sizeOf(context).height,
),
builder: (context) => const LikeFiltersBottomSheet(),
);
},
),
),
],
Expanded(
child: Consumer<LikedTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.feedback ?? []).isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
final feedback = viewModel.data?.data?.feedback ?? [];
if (feedback.isEmpty) {
return const Center(
child: Text(LikedTendersStrings.noLikedTenders),
);
}
final currentPage = viewModel.currentPage;
final totalPages = viewModel.data?.data?.meta?.pages ?? 1;
return Column(
children: [
_likedTendersList(feedback, viewModel),
SizedBox(height: 10.0.h()),
_likeTendersListPagesControll(
context,
totalPages,
viewModel,
currentPage,
),
SizedBox(height: 30.0.h()),
],
);
},
),
),
],
),
),
),
),
@@ -40,162 +40,164 @@ class _DesktopNotificationPageState extends State<DesktopNotificationPage>
Widget build(BuildContext context) {
final viewModel = context.watch<NotificationViewModel>();
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Column(
children: [
const DesktopNavigationWidget(currentIndex: 3),
SizedBox(height: 60.0.h()),
Expanded(
child: Center(
child: SizedBox(
width: 740,
child: Column(
children: [
MainTabBar(
controller: controller,
titles: [
NotificationStrings.all,
NotificationStrings.unread,
NotificationStrings.important,
],
),
SizedBox(height: 12.0.h()),
Padding(
padding: EdgeInsetsDirectional.only(end: 24.0.w()),
child: Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
viewModel.markAllAsRead(context);
},
borderRadius: BorderRadius.circular(99),
child: Container(
width: 132.0.w(),
height: 32.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(99),
),
child: Center(
child: Text(
NotificationStrings.markAllAsReadButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.mainBlue,
),
),
),
),
),
return SafeArea(
child: Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Column(
children: [
const DesktopNavigationWidget(currentIndex: 3),
SizedBox(height: 60.0.h()),
Expanded(
child: Center(
child: SizedBox(
width: 740,
child: Column(
children: [
MainTabBar(
controller: controller,
titles: [
NotificationStrings.all,
NotificationStrings.unread,
NotificationStrings.important,
],
),
),
SizedBox(height: 12.0.h()),
viewModel.isLoading
? Container()
: Expanded(
child: TabBarView(
controller: controller,
children: const [
NotificationAllTab(),
NotificationUnreadTab(),
NotificationImportantTab(),
],
),
),
if (viewModel.isLoading) ...[
const Spacer(),
const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
),
const Spacer(),
],
SizedBox(height: 10.0.h()),
Row(
children: [
const Spacer(),
Text(
NotificationStrings.page,
style: TextStyle(
fontSize: 13.0.sp(),
fontWeight: FontWeight.w300,
color: AppColors.grey60,
),
),
SizedBox(width: 10.0.w()),
InkWell(
onTap: () async {
final selectedPage = await showDialog<int>(
context: context,
builder:
(context) => PageSelectionDialog(
totalPages: viewModel.totalPages,
),
);
if (selectedPage != null) {
viewModel.jumpToPage(selectedPage);
}
},
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: AppColors.grey30,
width: 1,
SizedBox(height: 12.0.h()),
Padding(
padding: EdgeInsetsDirectional.only(end: 24.0.w()),
child: Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
viewModel.markAllAsRead(context);
},
borderRadius: BorderRadius.circular(99),
child: Container(
width: 132.0.w(),
height: 32.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(99),
),
borderRadius: BorderRadius.circular(4),
),
child: Row(
children: [
SizedBox(width: 5.0.w()),
Text(
viewModel.currentPage.toString(),
child: Center(
child: Text(
NotificationStrings.markAllAsReadButton,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.grey70,
color: AppColors.mainBlue,
),
),
SizedBox(width: 5.0.w()),
Icon(
Icons.arrow_drop_down,
color: AppColors.grey80,
),
SizedBox(width: 5.0.w()),
],
),
),
),
),
SizedBox(width: 5.0.w()),
Text(
NotificationStrings.of,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
SizedBox(width: 5.0.w()),
Text(
viewModel.totalPages.toString(),
style: TextStyle(
fontSize: 13.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
SizedBox(height: 12.0.h()),
viewModel.isLoading
? Container()
: Expanded(
child: TabBarView(
controller: controller,
children: const [
NotificationAllTab(),
NotificationUnreadTab(),
NotificationImportantTab(),
],
),
),
if (viewModel.isLoading) ...[
const Spacer(),
const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
),
const Spacer(),
],
),
SizedBox(height: 30.0.h()),
],
SizedBox(height: 10.0.h()),
Row(
children: [
const Spacer(),
Text(
NotificationStrings.page,
style: TextStyle(
fontSize: 13.0.sp(),
fontWeight: FontWeight.w300,
color: AppColors.grey60,
),
),
SizedBox(width: 10.0.w()),
InkWell(
onTap: () async {
final selectedPage = await showDialog<int>(
context: context,
builder:
(context) => PageSelectionDialog(
totalPages: viewModel.totalPages,
),
);
if (selectedPage != null) {
viewModel.jumpToPage(selectedPage);
}
},
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: AppColors.grey30,
width: 1,
),
borderRadius: BorderRadius.circular(4),
),
child: Row(
children: [
SizedBox(width: 5.0.w()),
Text(
viewModel.currentPage.toString(),
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.grey70,
),
),
SizedBox(width: 5.0.w()),
Icon(
Icons.arrow_drop_down,
color: AppColors.grey80,
),
SizedBox(width: 5.0.w()),
],
),
),
),
SizedBox(width: 5.0.w()),
Text(
NotificationStrings.of,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
SizedBox(width: 5.0.w()),
Text(
viewModel.totalPages.toString(),
style: TextStyle(
fontSize: 13.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
],
),
SizedBox(height: 30.0.h()),
],
),
),
),
),
),
],
],
),
),
);
}
@@ -112,7 +112,17 @@ class _MobileNotificationPageState extends State<MobileNotificationPage>
],
),
),
if (viewModel.isLoading) ...[
if (viewModel.isMoreLoading) ...[
const Padding(
padding: EdgeInsets.symmetric(vertical: 16),
child: Center(
child: CircularProgressIndicator(color: AppColors.secondary50),
),
),
],
if (viewModel.isLoading &&
(viewModel.notificationResponse?.data?.notifications?.isEmpty ??
true)) ...[
const Spacer(),
const Center(
child: CircularProgressIndicator(color: AppColors.secondary50),
@@ -11,5 +11,14 @@ class NotificationStrings {
static const String currentPage = 'currentPage';
static const String of = 'of';
static const String totalPages = 'totalPages';
static const String allNotificationMarkedAsRead = 'All notifications marked as read.';
static const String unknownResponse = 'Unknown response';
static const String now = 'Now';
static const String min = 'Min';
static const String hour = 'Hour';
static const String yesterday = 'Yesterday';
static const String daysAgo = 'days ago';
static const String reject = 'reject';
static const String info = 'info';
static const String noUnreadNotifications = 'No unread notifications';
}
@@ -6,6 +6,7 @@ import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/notification_data/notification_data.dart';
import 'package:tm_app/view_models/notification_view_model.dart';
import 'package:tm_app/views/notification/strings/notification_strings.dart';
class NotificationCard extends StatelessWidget {
final NotificationItem notification;
@@ -20,17 +21,17 @@ class NotificationCard extends StatelessWidget {
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
color:
notification.type == 'reject'
notification.type == NotificationStrings.reject
? AppColors.orange10
: notification.type == 'info'
: notification.type == NotificationStrings.info
? AppColors.primary10Light
: AppColors.green0,
borderRadius: BorderRadius.circular(4),
border: Border.all(
color:
notification.type! == 'reject'
notification.type! == NotificationStrings.reject
? AppColors.warningColor
: notification.type == 'info' ? AppColors.primary20 : AppColors.green20,
: notification.type == NotificationStrings.info ? AppColors.primary20 : AppColors.green20,
),
),
child: Row(
@@ -39,9 +40,9 @@ class NotificationCard extends StatelessWidget {
Padding(
padding: EdgeInsets.only(top: 3.0.h()),
child: SvgPicture.asset(
notification.type! == 'info'
notification.type! == NotificationStrings.info
? AssetsManager.notification
: notification.type! == 'reject'
: notification.type! == NotificationStrings.reject
? AssetsManager.danger
: AssetsManager.tickCircle,
),
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/view_models/notification_view_model.dart';
import 'package:tm_app/views/notification/strings/notification_strings.dart';
import 'notification_card.dart';
@@ -21,7 +22,7 @@ class NotificationUnreadTab extends StatelessWidget {
viewModel.unreadNotificationResponse?.data?.notifications ?? [];
if (notifications.isEmpty) {
return const Center(child: Text('No unread notifications'));
return const Center(child: Text(NotificationStrings.noUnreadNotifications,));
}
return ListView.builder(
+74 -72
View File
@@ -64,85 +64,87 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
return const Center(child: Text(CommonStrings.noData));
}
return Column(
children: [
const DesktopNavigationWidget(
currentIndex: 4, // Tenders index
),
SizedBox(
width: 740,
child: Column(
children: [
SizedBox(height: 36.0.h()),
TitleDescription(
title: ProfileStrings.companyName,
description: viewModel.companyProfileData!.name!,
),
TitleDescription(
title: ProfileStrings.nationalId,
description: viewModel.companyProfileData!.id!,
),
TitleDescription(
title: ProfileStrings.registrationNumber,
description:
viewModel.companyProfileData!.registrationNumber!,
),
const TitleDescription(
title: ProfileStrings.businessType,
description: '-',
),
TitleDescription(
title: ProfileStrings.founded,
description:
viewModel.companyProfileData!.foundedYear!.toString(),
),
SizedBox(height: 24.0.h()),
// Theme Toggle
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(
ProfileStrings.settings,
style: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey70,
return SafeArea(
child: Column(
children: [
const DesktopNavigationWidget(
currentIndex: 4, // Tenders index
),
SizedBox(
width: 740,
child: Column(
children: [
SizedBox(height: 36.0.h()),
TitleDescription(
title: ProfileStrings.companyName,
description: viewModel.companyProfileData!.name!,
),
TitleDescription(
title: ProfileStrings.nationalId,
description: viewModel.companyProfileData!.id!,
),
TitleDescription(
title: ProfileStrings.registrationNumber,
description:
viewModel.companyProfileData!.registrationNumber!,
),
const TitleDescription(
title: ProfileStrings.businessType,
description: '-',
),
TitleDescription(
title: ProfileStrings.founded,
description:
viewModel.companyProfileData!.foundedYear!.toString(),
),
SizedBox(height: 24.0.h()),
// Theme Toggle
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(
ProfileStrings.settings,
style: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey70,
),
),
),
),
SizedBox(height: 36.0.h()),
_themeChangeRow(),
SizedBox(height: 24.0.h()),
Divider(color: AppColors.dividerColor, thickness: 1),
SizedBox(height: 24.0.h()),
// Spacer(),
Align(
alignment: AlignmentDirectional.centerEnd,
child: InkWell(
onTap: () => viewModel.logout(),
borderRadius: BorderRadius.circular(100),
child: Container(
width: 156,
height: 56.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(100),
),
alignment: Alignment.center,
child: Text(
ProfileStrings.logout,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.primaryColor,
SizedBox(height: 36.0.h()),
_themeChangeRow(),
SizedBox(height: 24.0.h()),
Divider(color: AppColors.dividerColor, thickness: 1),
SizedBox(height: 24.0.h()),
// Spacer(),
Align(
alignment: AlignmentDirectional.centerEnd,
child: InkWell(
onTap: () => viewModel.logout(),
borderRadius: BorderRadius.circular(100),
child: Container(
width: 156,
height: 56.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(100),
),
alignment: Alignment.center,
child: Text(
ProfileStrings.logout,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.primaryColor,
),
),
),
),
),
),
],
],
),
),
),
],
],
),
);
},
),
+66 -64
View File
@@ -66,76 +66,78 @@ class _MobileProfilePageState extends State<MobileProfilePage> {
return const Center(child: Text(CommonStrings.noData));
}
return Padding(
padding: EdgeInsets.symmetric(
horizontal: 24.0.w(),
vertical: 16.0.h(),
),
child: Column(
children: [
SizedBox(height: 36.0.h()),
TitleDescription(
title: ProfileStrings.companyName,
description: viewModel.companyProfileData!.name!,
),
TitleDescription(
title: ProfileStrings.nationalId,
description: viewModel.companyProfileData!.id!,
),
TitleDescription(
title: ProfileStrings.registrationNumber,
description:
viewModel.companyProfileData!.registrationNumber!,
),
const TitleDescription(
title: ProfileStrings.businessType,
description: '-',
),
TitleDescription(
title: ProfileStrings.founded,
description:
viewModel.companyProfileData!.foundedYear!.toString(),
),
SizedBox(height: 32.0.h()),
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(
ProfileStrings.settings,
style: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey70,
),
return SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 24.0.w(),
vertical: 16.0.h(),
),
child: Column(
children: [
SizedBox(height: 36.0.h()),
TitleDescription(
title: ProfileStrings.companyName,
description: viewModel.companyProfileData!.name!,
),
),
SizedBox(height: 36.0.h()),
_themeChangeRow(),
SizedBox(height: 24.0.h()),
Divider(color: AppColors.dividerColor, thickness: 1),
SizedBox(height: 24.0.h()),
const Spacer(),
InkWell(
onTap: () => viewModel.logout(),
borderRadius: BorderRadius.circular(100),
child: Container(
width: double.infinity,
height: 56.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(100),
),
alignment: Alignment.center,
TitleDescription(
title: ProfileStrings.nationalId,
description: viewModel.companyProfileData!.id!,
),
TitleDescription(
title: ProfileStrings.registrationNumber,
description:
viewModel.companyProfileData!.registrationNumber!,
),
const TitleDescription(
title: ProfileStrings.businessType,
description: '-',
),
TitleDescription(
title: ProfileStrings.founded,
description:
viewModel.companyProfileData!.foundedYear!.toString(),
),
SizedBox(height: 32.0.h()),
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(
ProfileStrings.logout,
ProfileStrings.settings,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.primaryColor,
fontSize: 20.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey70,
),
),
),
),
],
SizedBox(height: 36.0.h()),
_themeChangeRow(),
SizedBox(height: 24.0.h()),
Divider(color: AppColors.dividerColor, thickness: 1),
SizedBox(height: 24.0.h()),
const Spacer(),
InkWell(
onTap: () => viewModel.logout(),
borderRadius: BorderRadius.circular(100),
child: Container(
width: double.infinity,
height: 56.0.h(),
decoration: BoxDecoration(
color: AppColors.primary20,
borderRadius: BorderRadius.circular(100),
),
alignment: Alignment.center,
child: Text(
ProfileStrings.logout,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.primaryColor,
),
),
),
),
],
),
),
);
},
+7 -7
View File
@@ -64,14 +64,14 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
return const Center(child: Text(CommonStrings.noData));
}
return SafeArea(
child: Scaffold(
key: key,
backgroundColor: AppColors.backgroundColor,
appBar: tabletAppBar(title: ProfileStrings.profileTitle, key: key),
return Scaffold(
key: key,
backgroundColor: AppColors.backgroundColor,
appBar: tabletAppBar(title: ProfileStrings.profileTitle, key: key),
drawer: const TabletNavigationWidget(currentIndex: 4),
body: Padding(
drawer: const TabletNavigationWidget(currentIndex: 4),
body: SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 24.0.w(),
vertical: 16.0.h(),
+6 -4
View File
@@ -41,10 +41,12 @@ class _DesktopSplashPageState extends State<DesktopSplashPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 100),
child: Image.asset(AssetsManager.logoBigPng),
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 100),
child: Image.asset(AssetsManager.logoBigPng),
),
),
),
);
+6 -4
View File
@@ -51,10 +51,12 @@ class _MobileSplashPageState extends State<MobileSplashPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
child: Image.asset(AssetsManager.logoBigPng, fit: BoxFit.cover),
body: SafeArea(
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
child: Image.asset(AssetsManager.logoBigPng, fit: BoxFit.cover),
),
),
),
);
+6 -4
View File
@@ -41,10 +41,12 @@ class _TabletSplashPageState extends State<TabletSplashPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Image.asset(AssetsManager.logoBigPng),
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Image.asset(AssetsManager.logoBigPng),
),
),
),
);
+48 -46
View File
@@ -51,58 +51,60 @@ class _DesktopTendersPageState extends State<DesktopTendersPage> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Column(
children: [
const DesktopNavigationWidget(currentIndex: 1),
SizedBox(height: 48.0.h()),
const _SearchBox(),
const _ActionButtons(),
Expanded(
child: Consumer<TendersViewModel>(
builder: (context, vm, child) {
if (vm.isLoading) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.jellyBean,
),
);
}
if (vm.errorMessage != null) {
return Center(child: Text(vm.errorMessage!));
}
final tenders = vm.tendersResponse?.data?.tenders ?? [];
if (tenders.isEmpty) {
return const Center(child: Text(CommonStrings.noData));
}
body: SafeArea(
child: Column(
children: [
const DesktopNavigationWidget(currentIndex: 1),
SizedBox(height: 48.0.h()),
const _SearchBox(),
const _ActionButtons(),
Expanded(
child: Consumer<TendersViewModel>(
builder: (context, vm, child) {
if (vm.isLoading) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.jellyBean,
),
);
}
if (vm.errorMessage != null) {
return Center(child: Text(vm.errorMessage!));
}
final tenders = vm.tendersResponse?.data?.tenders ?? [];
if (tenders.isEmpty) {
return const Center(child: Text(CommonStrings.noData));
}
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: SizedBox(
width: 740,
height: 800,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 4.0.h()),
child: MainTendersSlider(
tenders: tenders,
isDesktop: true,
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: SizedBox(
width: 740,
height: 800,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 4.0.h()),
child: MainTendersSlider(
tenders: tenders,
isDesktop: true,
),
),
),
),
),
),
_DesktopPagination(
totalPages: vm.totalPages,
currentPage: vm.currentPage,
onPageSelected: vm.jumpToPage,
),
],
);
},
_DesktopPagination(
totalPages: vm.totalPages,
currentPage: vm.currentPage,
onPageSelected: vm.jumpToPage,
),
],
);
},
),
),
),
],
],
),
),
);
}
+6 -4
View File
@@ -60,10 +60,12 @@ class _MobileTendersPageState extends State<MobileTendersPage> {
return const Center(child: Text(CommonStrings.noData));
}
return Padding(
padding: EdgeInsets.symmetric(vertical: 18.0.h()),
child: MainTendersSlider(
tenders: viewModel.tendersResponse?.data?.tenders ?? [],
return SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 18.0.h()),
child: MainTendersSlider(
tenders: viewModel.tendersResponse?.data?.tenders ?? [],
),
),
);
},
+9 -7
View File
@@ -51,13 +51,15 @@ class _TabletTendersPageState extends State<TabletTendersPage> {
}
return Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsetsDirectional.only(
end: 24.0.w(),
top: 128.0.h(),
),
child: MainTendersSlider(
tenders: viewModel.tendersResponse?.data?.tenders ?? [],
child: SafeArea(
child: Padding(
padding: EdgeInsetsDirectional.only(
end: 24.0.w(),
top: 128.0.h(),
),
child: MainTendersSlider(
tenders: viewModel.tendersResponse?.data?.tenders ?? [],
),
),
),
),
@@ -39,88 +39,90 @@ class _YourTendersDesktopPageState extends State<YourTendersDesktopPage>
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: Column(
children: [
const DesktopNavigationWidget(currentIndex: 1), // Tenders index
Expanded(
child: SizedBox(
width: 740,
child: Column(
children: [
SizedBox(height: 64.0.h()),
const TabletDesktopAppbar(
title: YourTendersStrings.yourTenders,
),
SizedBox(height: 20.0.h()),
const FilterButton(platformType: PlatformType.tabletDesktop),
Expanded(
child: Consumer<YourTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data == null &&
viewModel.likedTendersData == null)) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
Widget content;
if (viewModel.selectedStatus ==
YourTendersStrings.likeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.liked.value,
isDesktop: true,
isMobile: false,
);
} else if (viewModel.selectedStatus ==
YourTendersStrings.dislikeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.disliked.value,
isDesktop: true,
isMobile: false,
);
} else if (viewModel.data != null) {
content = TendersSubmitted(
approvedTenders: viewModel.data!,
isDesktop: true,
isMobile: false,
);
} else {
content = const Center(
child: Text(YourTendersStrings.noTenders),
);
}
return Column(
children: [
Expanded(child: content),
SizedBox(height: 10.0.h()),
_listPagesControll(context, viewModel),
SizedBox(height: 30.0.h()),
],
);
},
body: SafeArea(
child: Column(
children: [
const DesktopNavigationWidget(currentIndex: 1), // Tenders index
Expanded(
child: SizedBox(
width: 740,
child: Column(
children: [
SizedBox(height: 64.0.h()),
const TabletDesktopAppbar(
title: YourTendersStrings.yourTenders,
),
),
],
SizedBox(height: 20.0.h()),
const FilterButton(platformType: PlatformType.tabletDesktop),
Expanded(
child: Consumer<YourTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data == null &&
viewModel.likedTendersData == null)) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
Widget content;
if (viewModel.selectedStatus ==
YourTendersStrings.likeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.liked.value,
isDesktop: true,
isMobile: false,
);
} else if (viewModel.selectedStatus ==
YourTendersStrings.dislikeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.disliked.value,
isDesktop: true,
isMobile: false,
);
} else if (viewModel.data != null) {
content = TendersSubmitted(
approvedTenders: viewModel.data!,
isDesktop: true,
isMobile: false,
);
} else {
content = const Center(
child: Text(YourTendersStrings.noTenders),
);
}
return Column(
children: [
Expanded(child: content),
SizedBox(height: 10.0.h()),
_listPagesControll(context, viewModel),
SizedBox(height: 30.0.h()),
],
);
},
),
),
],
),
),
),
),
],
],
),
),
);
}
@@ -38,71 +38,73 @@ class _YourTendersMobilePageState extends State<YourTendersMobilePage> {
return Scaffold(
backgroundColor: AppColors.backgroundColor,
appBar: appBar(context: context, title: YourTendersStrings.yourTenders),
body: Column(
children: [
const FilterButton(platformType: PlatformType.mobile),
Expanded(
child: Consumer<YourTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.tenders ?? []).isEmpty &&
(viewModel.likedTendersData?.data?.feedback ?? [])
.isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
return Column(
children: [
if (viewModel.selectedStatus ==
YourTendersStrings.likeTenders &&
viewModel.likedTendersData != null)
Expanded(
child: LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.liked.value,
isDesktop: false,
isMobile: true,
),
)
else if (viewModel.selectedStatus ==
YourTendersStrings.dislikeTenders &&
viewModel.likedTendersData != null)
Expanded(
child: LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.disliked.value,
isDesktop: false,
isMobile: true,
),
)
else if (viewModel.data != null)
Expanded(
child: TendersSubmitted(
approvedTenders: viewModel.data!,
isDesktop: false,
isMobile: true,
),
)
else
const Expanded(
child: Center(
child: Text(YourTendersStrings.noTenders),
),
body: SafeArea(
child: Column(
children: [
const FilterButton(platformType: PlatformType.mobile),
Expanded(
child: Consumer<YourTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data?.data?.tenders ?? []).isEmpty &&
(viewModel.likedTendersData?.data?.feedback ?? [])
.isEmpty) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
],
);
},
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
return Column(
children: [
if (viewModel.selectedStatus ==
YourTendersStrings.likeTenders &&
viewModel.likedTendersData != null)
Expanded(
child: LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.liked.value,
isDesktop: false,
isMobile: true,
),
)
else if (viewModel.selectedStatus ==
YourTendersStrings.dislikeTenders &&
viewModel.likedTendersData != null)
Expanded(
child: LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.disliked.value,
isDesktop: false,
isMobile: true,
),
)
else if (viewModel.data != null)
Expanded(
child: TendersSubmitted(
approvedTenders: viewModel.data!,
isDesktop: false,
isMobile: true,
),
)
else
const Expanded(
child: Center(
child: Text(YourTendersStrings.noTenders),
),
),
],
);
},
),
),
),
],
],
),
),
);
}
@@ -44,84 +44,86 @@ class _YourTendersTabletPageState extends State<YourTendersTabletPage>
backgroundColor: AppColors.backgroundColor,
appBar: tabletAppBar(title: YourTendersStrings.yourTenders, key: key),
drawer: const TabletNavigationWidget(currentIndex: 1),
body: Center(
child: SizedBox(
width: 720,
child: Column(
children: [
const SizedBox(height: 64.0),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
child: const TabletDesktopAppbar(
title: YourTendersStrings.yourTenders,
body: SafeArea(
child: Center(
child: SizedBox(
width: 720,
child: Column(
children: [
const SizedBox(height: 64.0),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
child: const TabletDesktopAppbar(
title: YourTendersStrings.yourTenders,
),
),
),
SizedBox(height: 24.0.h()),
const FilterButton(platformType: PlatformType.tabletDesktop),
SizedBox(height: 24.0.h()),
const FilterButton(platformType: PlatformType.tabletDesktop),
Expanded(
child: Consumer<YourTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data == null &&
viewModel.likedTendersData == null)) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
Expanded(
child: Consumer<YourTendersViewModel>(
builder: (context, viewModel, child) {
if (viewModel.isLoading &&
(viewModel.data == null &&
viewModel.likedTendersData == null)) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.secondary50,
),
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
Widget content;
if (viewModel.selectedStatus ==
YourTendersStrings.likeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.liked.value,
isDesktop: false,
isMobile: false,
);
} else if (viewModel.selectedStatus ==
YourTendersStrings.dislikeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.disliked.value,
isDesktop: false,
isMobile: false,
);
} else if (viewModel.data != null) {
content = TendersSubmitted(
approvedTenders: viewModel.data!,
isDesktop: false,
isMobile: false,
);
} else {
content = const Center(
child: Text(YourTendersStrings.noTenders),
);
}
return Column(
children: [
Expanded(child: content),
SizedBox(height: 10.0.h()),
_listPagesControll(context, viewModel),
const SizedBox(height: 30.0),
],
);
}
if (viewModel.errorMessage != null) {
return Center(child: Text(viewModel.errorMessage!));
}
Widget content;
if (viewModel.selectedStatus ==
YourTendersStrings.likeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.liked.value,
isDesktop: false,
isMobile: false,
);
} else if (viewModel.selectedStatus ==
YourTendersStrings.dislikeTenders &&
viewModel.likedTendersData != null) {
content = LikedDislikedTendersList(
data: viewModel.likedTendersData!,
status: TenderFeedback.disliked.value,
isDesktop: false,
isMobile: false,
);
} else if (viewModel.data != null) {
content = TendersSubmitted(
approvedTenders: viewModel.data!,
isDesktop: false,
isMobile: false,
);
} else {
content = const Center(
child: Text(YourTendersStrings.noTenders),
);
}
return Column(
children: [
Expanded(child: content),
SizedBox(height: 10.0.h()),
_listPagesControll(context, viewModel),
const SizedBox(height: 30.0),
],
);
},
},
),
),
),
],
],
),
),
),
),