diff --git a/lib/view_models/notification_view_model.dart b/lib/view_models/notification_view_model.dart index 21bf51b..fffad77 100644 --- a/lib/view_models/notification_view_model.dart +++ b/lib/view_models/notification_view_model.dart @@ -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 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>(): 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>(): _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}'; } } diff --git a/lib/views/completion_of_documents/pages/m_completion_of_documents_page.dart b/lib/views/completion_of_documents/pages/m_completion_of_documents_page.dart index 96cef20..7e8265b 100644 --- a/lib/views/completion_of_documents/pages/m_completion_of_documents_page.dart +++ b/lib/views/completion_of_documents/pages/m_completion_of_documents_page.dart @@ -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, + ), + ], + ), ), ), ); diff --git a/lib/views/detail/pages/detail_desktop_page.dart b/lib/views/detail/pages/detail_desktop_page.dart index 40c791a..2244d03 100644 --- a/lib/views/detail/pages/detail_desktop_page.dart +++ b/lib/views/detail/pages/detail_desktop_page.dart @@ -96,44 +96,46 @@ class _TenderDetailDesktopPageState extends State { 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, + ), + ], + ), ), ), ), ), ), - ), - ], + ], + ), ); }, ), diff --git a/lib/views/detail/pages/detail_mobile_page.dart b/lib/views/detail/pages/detail_mobile_page.dart index 2bd9777..6fb9d0e 100644 --- a/lib/views/detail/pages/detail_mobile_page.dart +++ b/lib/views/detail/pages/detail_mobile_page.dart @@ -102,21 +102,23 @@ class _TenderDetailMobilePageState extends State { ); } - 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), + ], + ), ), ), ); diff --git a/lib/views/detail/pages/detail_tablet_page.dart b/lib/views/detail/pages/detail_tablet_page.dart index a078b57..0a4678c 100644 --- a/lib/views/detail/pages/detail_tablet_page.dart +++ b/lib/views/detail/pages/detail_tablet_page.dart @@ -104,26 +104,28 @@ class _TenderDetailTabletPageState extends State { if (detail == null) { return const Center(child: Text(TenderDetailsStrings.tenderNoData)); } - return 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), - ], + 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), + ], + ), ), ), ), diff --git a/lib/views/final_completion_of_documents/pages/final_completion_of_documents_screen.dart b/lib/views/final_completion_of_documents/pages/final_completion_of_documents_screen.dart index 19c1a30..fe981d2 100644 --- a/lib/views/final_completion_of_documents/pages/final_completion_of_documents_screen.dart +++ b/lib/views/final_completion_of_documents/pages/final_completion_of_documents_screen.dart @@ -23,55 +23,57 @@ class FinalCompletionOfDocumentsScreen extends StatelessWidget { return Scaffold( body: Consumer( 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()), - - 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), - ], + (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), + ], + ), ), ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/views/home/pages/d_home_page.dart b/lib/views/home/pages/d_home_page.dart index f81370a..b184d63 100644 --- a/lib/views/home/pages/d_home_page.dart +++ b/lib/views/home/pages/d_home_page.dart @@ -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), + ], + ), ), ), ); diff --git a/lib/views/home/pages/m_home_page.dart b/lib/views/home/pages/m_home_page.dart index b0e75fe..6a8f445 100644 --- a/lib/views/home/pages/m_home_page.dart +++ b/lib/views/home/pages/m_home_page.dart @@ -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), + ], + ), ), ); } diff --git a/lib/views/home/pages/t_home_page.dart b/lib/views/home/pages/t_home_page.dart index fd2cc73..4d8ad26 100644 --- a/lib/views/home/pages/t_home_page.dart +++ b/lib/views/home/pages/t_home_page.dart @@ -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), + ], + ), ), ), ); diff --git a/lib/views/liked_tenders/pages/liked_tenders_desktop_page.dart b/lib/views/liked_tenders/pages/liked_tenders_desktop_page.dart index 8190547..91cbbe8 100644 --- a/lib/views/liked_tenders/pages/liked_tenders_desktop_page.dart +++ b/lib/views/liked_tenders/pages/liked_tenders_desktop_page.dart @@ -59,71 +59,73 @@ class _LikedTendersDesktopPageState extends State { 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( - 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( + 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()), + ], + ); + }, + ), + ), + ), + ], + ), ), ), ); diff --git a/lib/views/liked_tenders/pages/liked_tenders_mobile_page.dart b/lib/views/liked_tenders/pages/liked_tenders_mobile_page.dart index a402945..d5a0fd6 100644 --- a/lib/views/liked_tenders/pages/liked_tenders_mobile_page.dart +++ b/lib/views/liked_tenders/pages/liked_tenders_mobile_page.dart @@ -156,91 +156,93 @@ class _LikedTendersMobilePageState extends State { ), ), - body: Column( - children: [ - Expanded( - child: Consumer( - 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( + 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(), ), - ); - } - - 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(), + 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(), + ), + 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, - ), - ), - ), - ); - } - }, - ); - }, + ); + } + }, + ); + }, + ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/views/liked_tenders/pages/liked_tenders_tablet_page.dart b/lib/views/liked_tenders/pages/liked_tenders_tablet_page.dart index 6f98193..180797c 100644 --- a/lib/views/liked_tenders/pages/liked_tenders_tablet_page.dart +++ b/lib/views/liked_tenders/pages/liked_tenders_tablet_page.dart @@ -63,79 +63,81 @@ class _LikedTendersTabletPageState extends State { 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( - 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( + 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()), + ], + ); + }, + ), + ), + ], + ), ), ), ), diff --git a/lib/views/notification/pages/d_notification_page.dart b/lib/views/notification/pages/d_notification_page.dart index 5e3417e..ec40cc1 100644 --- a/lib/views/notification/pages/d_notification_page.dart +++ b/lib/views/notification/pages/d_notification_page.dart @@ -40,162 +40,164 @@ class _DesktopNotificationPageState extends State Widget build(BuildContext context) { final viewModel = context.watch(); - 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( - 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( + 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()), + ], + ), ), ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/views/notification/pages/m_notification_page.dart b/lib/views/notification/pages/m_notification_page.dart index 2d0a879..952a6c9 100644 --- a/lib/views/notification/pages/m_notification_page.dart +++ b/lib/views/notification/pages/m_notification_page.dart @@ -112,7 +112,17 @@ class _MobileNotificationPageState extends State ], ), ), - 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), diff --git a/lib/views/notification/strings/notification_strings.dart b/lib/views/notification/strings/notification_strings.dart index 2fd9c3e..767128a 100644 --- a/lib/views/notification/strings/notification_strings.dart +++ b/lib/views/notification/strings/notification_strings.dart @@ -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'; } diff --git a/lib/views/notification/widgets/notification_card.dart b/lib/views/notification/widgets/notification_card.dart index 7b65d94..ab98745 100644 --- a/lib/views/notification/widgets/notification_card.dart +++ b/lib/views/notification/widgets/notification_card.dart @@ -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, ), diff --git a/lib/views/notification/widgets/notification_unread_tab.dart b/lib/views/notification/widgets/notification_unread_tab.dart index efb980e..cc6afd5 100644 --- a/lib/views/notification/widgets/notification_unread_tab.dart +++ b/lib/views/notification/widgets/notification_unread_tab.dart @@ -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( diff --git a/lib/views/profile/pages/d_profile_page.dart b/lib/views/profile/pages/d_profile_page.dart index 452d65a..eac2cfc 100644 --- a/lib/views/profile/pages/d_profile_page.dart +++ b/lib/views/profile/pages/d_profile_page.dart @@ -64,85 +64,87 @@ class _DesktopProfilePageState extends State { 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, + ), ), ), ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ); }, ), diff --git a/lib/views/profile/pages/m_profile_page.dart b/lib/views/profile/pages/m_profile_page.dart index 01b25bb..b244b8f 100644 --- a/lib/views/profile/pages/m_profile_page.dart +++ b/lib/views/profile/pages/m_profile_page.dart @@ -66,76 +66,78 @@ class _MobileProfilePageState extends State { 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, + ), + ), + ), + ), + ], + ), ), ); }, diff --git a/lib/views/profile/pages/t_profile_page.dart b/lib/views/profile/pages/t_profile_page.dart index 188b038..c393c24 100644 --- a/lib/views/profile/pages/t_profile_page.dart +++ b/lib/views/profile/pages/t_profile_page.dart @@ -64,14 +64,14 @@ class _TabletProfilePageState extends State { return const Center(child: Text(CommonStrings.noData)); } - return SafeArea( - child: Scaffold( - key: key, - backgroundColor: AppColors.backgroundColor, - appBar: tabletAppBar(title: ProfileStrings.profileTitle, key: key), - - drawer: const TabletNavigationWidget(currentIndex: 4), - body: Padding( + return Scaffold( + key: key, + backgroundColor: AppColors.backgroundColor, + appBar: tabletAppBar(title: ProfileStrings.profileTitle, key: key), + + drawer: const TabletNavigationWidget(currentIndex: 4), + body: SafeArea( + child: Padding( padding: EdgeInsets.symmetric( horizontal: 24.0.w(), vertical: 16.0.h(), diff --git a/lib/views/splash/pages/d_splash_page.dart b/lib/views/splash/pages/d_splash_page.dart index c3f44ef..a218014 100644 --- a/lib/views/splash/pages/d_splash_page.dart +++ b/lib/views/splash/pages/d_splash_page.dart @@ -41,10 +41,12 @@ class _DesktopSplashPageState extends State { @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), + ), ), ), ); diff --git a/lib/views/splash/pages/m_splash_page.dart b/lib/views/splash/pages/m_splash_page.dart index 05b2098..b2f008d 100644 --- a/lib/views/splash/pages/m_splash_page.dart +++ b/lib/views/splash/pages/m_splash_page.dart @@ -51,10 +51,12 @@ class _MobileSplashPageState extends State { @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), + ), ), ), ); diff --git a/lib/views/splash/pages/t_splash_page.dart b/lib/views/splash/pages/t_splash_page.dart index 8b09333..017ff9d 100644 --- a/lib/views/splash/pages/t_splash_page.dart +++ b/lib/views/splash/pages/t_splash_page.dart @@ -41,10 +41,12 @@ class _TabletSplashPageState extends State { @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), + ), ), ), ); diff --git a/lib/views/tenders/pages/d_tenders_page.dart b/lib/views/tenders/pages/d_tenders_page.dart index 683333d..173cf44 100644 --- a/lib/views/tenders/pages/d_tenders_page.dart +++ b/lib/views/tenders/pages/d_tenders_page.dart @@ -51,58 +51,60 @@ class _DesktopTendersPageState extends State { 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( - 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, + body: SafeArea( + child: Column( + children: [ + const DesktopNavigationWidget(currentIndex: 1), + SizedBox(height: 48.0.h()), + const _SearchBox(), + const _ActionButtons(), + Expanded( + child: Consumer( + 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, + ), ), ), ), ), - ), - _DesktopPagination( - totalPages: vm.totalPages, - currentPage: vm.currentPage, - onPageSelected: vm.jumpToPage, - ), - ], - ); - }, + _DesktopPagination( + totalPages: vm.totalPages, + currentPage: vm.currentPage, + onPageSelected: vm.jumpToPage, + ), + ], + ); + }, + ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/views/tenders/pages/m_tenders_page.dart b/lib/views/tenders/pages/m_tenders_page.dart index 4dd006d..35d611c 100644 --- a/lib/views/tenders/pages/m_tenders_page.dart +++ b/lib/views/tenders/pages/m_tenders_page.dart @@ -60,10 +60,12 @@ class _MobileTendersPageState extends State { 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 ?? [], + ), ), ); }, diff --git a/lib/views/tenders/pages/t_tenders_page.dart b/lib/views/tenders/pages/t_tenders_page.dart index 53d03dd..fd0c2a6 100644 --- a/lib/views/tenders/pages/t_tenders_page.dart +++ b/lib/views/tenders/pages/t_tenders_page.dart @@ -51,13 +51,15 @@ class _TabletTendersPageState extends State { } 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 ?? [], + ), ), ), ), diff --git a/lib/views/your_tenders/pages/your_tenders_desktop_page.dart b/lib/views/your_tenders/pages/your_tenders_desktop_page.dart index 07c667b..ef002da 100644 --- a/lib/views/your_tenders/pages/your_tenders_desktop_page.dart +++ b/lib/views/your_tenders/pages/your_tenders_desktop_page.dart @@ -39,88 +39,90 @@ class _YourTendersDesktopPageState extends State 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( - 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( + 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()), + ], + ); + }, + ), + ), + ], + ), ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/views/your_tenders/pages/your_tenders_mobile_page.dart b/lib/views/your_tenders/pages/your_tenders_mobile_page.dart index e4ca33c..a7b300c 100644 --- a/lib/views/your_tenders/pages/your_tenders_mobile_page.dart +++ b/lib/views/your_tenders/pages/your_tenders_mobile_page.dart @@ -38,71 +38,73 @@ class _YourTendersMobilePageState extends State { return Scaffold( backgroundColor: AppColors.backgroundColor, appBar: appBar(context: context, title: YourTendersStrings.yourTenders), - body: Column( - children: [ - const FilterButton(platformType: PlatformType.mobile), - Expanded( - child: Consumer( - 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( + 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), + ), + ), + ], + ); + }, + ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/views/your_tenders/pages/your_tenders_tablet_page.dart b/lib/views/your_tenders/pages/your_tenders_tablet_page.dart index 518e67a..c40010c 100644 --- a/lib/views/your_tenders/pages/your_tenders_tablet_page.dart +++ b/lib/views/your_tenders/pages/your_tenders_tablet_page.dart @@ -44,84 +44,86 @@ class _YourTendersTabletPageState extends State 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), - - Expanded( - child: Consumer( - builder: (context, viewModel, child) { - if (viewModel.isLoading && - (viewModel.data == null && - viewModel.likedTendersData == null)) { - return const Center( - child: CircularProgressIndicator( - color: AppColors.secondary50, - ), + SizedBox(height: 24.0.h()), + const FilterButton(platformType: PlatformType.tabletDesktop), + + Expanded( + child: Consumer( + 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), - ], - ); - }, + }, + ), ), - ), - ], + ], + ), ), ), ),