diff --git a/lib/core/routes/app_routes.dart b/lib/core/routes/app_routes.dart index e7bc7ab..5536360 100644 --- a/lib/core/routes/app_routes.dart +++ b/lib/core/routes/app_routes.dart @@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:tm_app/views/completion_of_documents/pages/complectopn_of_documents_screen.dart'; -import 'package:tm_app/views/completion_of_documents/pages/m_completion_of_documents_page.dart'; import 'package:tm_app/views/detail/pages/detail_screen.dart'; import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart'; import 'package:tm_app/views/forget_password_otp/pages/forgot_password_otp_screen.dart'; @@ -236,17 +235,14 @@ class FinalCompletionOfDocumentsRouteData extends GoRouteData } } -@TypedGoRoute( - path: '/completion_of_documents', -) +@TypedGoRoute(path: '/completion_of_documents') class CompletionOfDocumentsRouteData extends GoRouteData with _$CompletionOfDocumentsRouteData { const CompletionOfDocumentsRouteData(); @override Widget build(BuildContext context, GoRouterState state) { - return const CompletionOfDocumentsScreen(); - + return const CompletionOfDocumentsScreen(); } } @@ -260,20 +256,20 @@ class LikedTendersRouteData extends GoRouteData with _$LikedTendersRouteData { } } -@TypedGoRoute( - path: '/completion-of-documents', -) -class CompletionOfDocumentsMobileRouteData extends GoRouteData - with _$CompletionOfDocumentsMobileRouteData { - const CompletionOfDocumentsMobileRouteData(); +// @TypedGoRoute( +// path: '/completion-of-documents', +// ) +// class CompletionOfDocumentsMobileRouteData extends GoRouteData +// with _$CompletionOfDocumentsMobileRouteData { +// const CompletionOfDocumentsMobileRouteData(); - @override - Widget build(BuildContext context, GoRouterState state) { - return finalCompletionProvider( - child: const CompletionOfDocumentsMobilePage(), - ); - } -} +// @override +// Widget build(BuildContext context, GoRouterState state) { +// return finalCompletionProvider( +// child: const CompletionOfDocumentsMobilePage(), +// ); +// } +// } @TypedGoRoute(path: '/tender-detail') class TenderDetailRouteData extends GoRouteData with _$TenderDetailRouteData { diff --git a/lib/core/routes/app_routes.g.dart b/lib/core/routes/app_routes.g.dart index 6c2b7b6..f462082 100644 --- a/lib/core/routes/app_routes.g.dart +++ b/lib/core/routes/app_routes.g.dart @@ -14,7 +14,6 @@ List get $appRoutes => [ $finalCompletionOfDocumentsRouteData, $completionOfDocumentsRouteData, $likedTendersRouteData, - $completionOfDocumentsMobileRouteData, $tenderDetailRouteData, $forgotPasswordRouteData, $forgotPasswordOtpRouteData, @@ -349,33 +348,6 @@ mixin _$LikedTendersRouteData on GoRouteData { void replace(BuildContext context) => context.replace(location); } -RouteBase get $completionOfDocumentsMobileRouteData => GoRouteData.$route( - path: '/completion-of-documents', - - factory: _$CompletionOfDocumentsMobileRouteData._fromState, -); - -mixin _$CompletionOfDocumentsMobileRouteData on GoRouteData { - static CompletionOfDocumentsMobileRouteData _fromState(GoRouterState state) => - const CompletionOfDocumentsMobileRouteData(); - - @override - String get location => GoRouteData.$location('/completion-of-documents'); - - @override - void go(BuildContext context) => context.go(location); - - @override - Future push(BuildContext context) => context.push(location); - - @override - void pushReplacement(BuildContext context) => - context.pushReplacement(location); - - @override - void replace(BuildContext context) => context.replace(location); -} - RouteBase get $tenderDetailRouteData => GoRouteData.$route( path: '/tender-detail', diff --git a/lib/view_models/tender_detail_view_model.dart b/lib/view_models/tender_detail_view_model.dart index 86049da..d5b0b0d 100644 --- a/lib/view_models/tender_detail_view_model.dart +++ b/lib/view_models/tender_detail_view_model.dart @@ -28,6 +28,7 @@ class TenderDetailViewModel with ChangeNotifier { TenderApprovalsData? _tenderApprovalData; bool approvalStatus = false; String _status = ''; + String _meetingTime = ''; bool get isLoading => _isLoading; bool get isSubmitApprovalLoading => _isSubmitApprovalLoading; @@ -36,6 +37,12 @@ class TenderDetailViewModel with ChangeNotifier { TenderData? get tenderDetail => _tenderDetail; TenderApprovalsData? get tenderApprovalData => _tenderApprovalData; String get status => _status; + String get meetingTime => _meetingTime; + + set meetingTime(String value) { + _meetingTime = value; + notifyListeners(); + } Future getTenderDetail({required String id}) async { _isLoading = true; diff --git a/lib/views/completion_of_documents/pages/d_completion_of_documents_page.dart b/lib/views/completion_of_documents/pages/d_completion_of_documents_page.dart index bd97161..6f82ce5 100644 --- a/lib/views/completion_of_documents/pages/d_completion_of_documents_page.dart +++ b/lib/views/completion_of_documents/pages/d_completion_of_documents_page.dart @@ -6,6 +6,8 @@ import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/views/completion_of_documents/strings/completion_of_documents_string.dart'; import 'package:tm_app/views/shared/base_button.dart'; import 'package:tm_app/views/shared/desktop_navigation_widget.dart'; +import 'package:tm_app/views/shared/tablet_desktop_appbar.dart' + show TabletDesktopAppbar; class CompletionOfDocumentsDesktopPage extends StatelessWidget { const CompletionOfDocumentsDesktopPage({super.key}); @@ -17,36 +19,24 @@ class CompletionOfDocumentsDesktopPage extends StatelessWidget { body: Column( children: [ const DesktopNavigationWidget(currentIndex: 0), - SizedBox( - width: 760, + Expanded( child: SingleChildScrollView( - child: Center( - child: SizedBox( - child: Padding( - padding: EdgeInsets.symmetric(vertical: 24.0.h()), - child: Expanded( + child: SizedBox( + width: double.infinity, + child: Center( + child: SizedBox( + width: 760, + child: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - SvgPicture.asset( - AssetsManager.arrowLeft, - width: 24.0.w(), - height: 24.0.h(), - ), - SizedBox(width: 8.0.w()), - Text( + SizedBox(height: 40.0.h()), + const TabletDesktopAppbar( + title: CompletionOfDocumentsStrings .completionOfDocuments, - style: TextStyle( - color: AppColors.grey70, - fontSize: 16.0.sp(), - fontWeight: FontWeight.w600, - ), - ), - ], ), + SizedBox(height: 24.0.h()), _deadlineContainer(), @@ -78,6 +68,7 @@ class CompletionOfDocumentsDesktopPage extends StatelessWidget { textColor: AppColors.textBlue, backgroundColor: AppColors.primary30, ), + SizedBox(height: 24.0.h()), ], ), ), 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 f7db376..bed33ca 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 @@ -6,6 +6,8 @@ import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/views/completion_of_documents/strings/completion_of_documents_string.dart'; import 'package:tm_app/views/shared/base_button.dart'; +import '../../shared/tender_app_bar.dart'; + class CompletionOfDocumentsMobilePage extends StatelessWidget { const CompletionOfDocumentsMobilePage({super.key}); @@ -13,10 +15,10 @@ class CompletionOfDocumentsMobilePage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.backgroundColor, - // appBar: appBar( - // context: context, - // title: CompletionOfDocumentsStrings.completionOfDocuments, - // ), + appBar: appBar( + context: context, + title: CompletionOfDocumentsStrings.completionOfDocuments, + ), body: SafeArea( child: SingleChildScrollView( padding: EdgeInsets.symmetric( @@ -26,26 +28,6 @@ class CompletionOfDocumentsMobilePage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - SvgPicture.asset( - AssetsManager.arrowLeft, - width: 24.0.w(), - height: 24.0.h(), - ), - SizedBox(width: 8.0.w()), - Text( - CompletionOfDocumentsStrings.completionOfDocuments, - style: TextStyle( - color: AppColors.grey70, - fontSize: 16.0.sp(), - fontWeight: FontWeight.w600, - ), - ), - ], - ), - SizedBox(height: 24.0.h()), - Container( width: double.infinity, height: 24.0.h(), diff --git a/lib/views/detail/pages/detail_desktop_page.dart b/lib/views/detail/pages/detail_desktop_page.dart index 2244d03..6cf75d1 100644 --- a/lib/views/detail/pages/detail_desktop_page.dart +++ b/lib/views/detail/pages/detail_desktop_page.dart @@ -126,6 +126,7 @@ class _TenderDetailDesktopPageState extends State { TenderDetailActions( isScreenBig: true, detail: detail, + viewModel: viewModel, ), ], ), diff --git a/lib/views/detail/pages/detail_mobile_page.dart b/lib/views/detail/pages/detail_mobile_page.dart index 797c2cc..0d76ffa 100644 --- a/lib/views/detail/pages/detail_mobile_page.dart +++ b/lib/views/detail/pages/detail_mobile_page.dart @@ -114,7 +114,11 @@ class _TenderDetailMobilePageState extends State { SizedBox(height: 24.0.h()), TenderDetailCard(detail: detail), SizedBox(height: 24.0.h()), - TenderDetailActions(isScreenBig: false, detail: detail), + TenderDetailActions( + isScreenBig: false, + detail: detail, + viewModel: viewModel, + ), ], ), ), diff --git a/lib/views/detail/pages/detail_tablet_page.dart b/lib/views/detail/pages/detail_tablet_page.dart index e8eef3e..a953d03 100644 --- a/lib/views/detail/pages/detail_tablet_page.dart +++ b/lib/views/detail/pages/detail_tablet_page.dart @@ -125,7 +125,11 @@ class _TenderDetailTabletPageState extends State { SizedBox(height: 28.0.h()), TenderDetailCard(detail: detail), SizedBox(height: 24.0.h()), - TenderDetailActions(isScreenBig: true, detail: detail), + TenderDetailActions( + isScreenBig: true, + detail: detail, + viewModel: viewModel, + ), ], ), ), diff --git a/lib/views/detail/strings/tender_details_strings.dart b/lib/views/detail/strings/tender_details_strings.dart index 9d152fd..61b36c8 100644 --- a/lib/views/detail/strings/tender_details_strings.dart +++ b/lib/views/detail/strings/tender_details_strings.dart @@ -37,4 +37,6 @@ class TenderDetailsStrings { static const String pleaseReplyBy = 'If you’d like to join, Please Reply by '; static const String lastDayToPrepareProposal = 'Last day to prepare proposal is '; + static const String meetingTimeSuccessfullySet = + 'meeting time successfully set'; } diff --git a/lib/views/detail/widgets/select_meeting_time_bottom_sheet.dart b/lib/views/detail/widgets/meeting_time_bottom_sheet.dart similarity index 60% rename from lib/views/detail/widgets/select_meeting_time_bottom_sheet.dart rename to lib/views/detail/widgets/meeting_time_bottom_sheet.dart index be383a6..953f8b6 100644 --- a/lib/views/detail/widgets/select_meeting_time_bottom_sheet.dart +++ b/lib/views/detail/widgets/meeting_time_bottom_sheet.dart @@ -1,21 +1,20 @@ import 'package:flutter/material.dart'; -import 'package:tm_app/core/routes/app_routes.dart'; -import 'package:tm_app/core/theme/colors.dart'; +import 'package:go_router/go_router.dart'; import 'package:tm_app/core/utils/size_config.dart'; -import 'package:tm_app/views/detail/strings/tender_details_strings.dart'; -class SelectMeetingTimeBottomSheet extends StatefulWidget { - const SelectMeetingTimeBottomSheet({required this.onConfirm, required this.isDialog, super.key}); +import '../../../core/routes/app_routes.dart'; +import '../../../core/theme/colors.dart'; +import '../strings/tender_details_strings.dart'; + +class MeetingTimeBottomSheet extends StatefulWidget { + const MeetingTimeBottomSheet({required this.onConfirm, super.key}); final ValueChanged onConfirm; - final bool isDialog; @override - State createState() => - _SelectMeetingTimeBottomSheetState(); + State createState() => _MeetingTimeBottomSheetState(); } -class _SelectMeetingTimeBottomSheetState - extends State { +class _MeetingTimeBottomSheetState extends State { int selectedType = 0; late String type = ''; @@ -26,7 +25,6 @@ class _SelectMeetingTimeBottomSheetState {'title': 'Sun 2025-06-18', 'value': 'mode4', 'time': '16:00'}, {'title': 'Sun 2025-06-19', 'value': 'mode5', 'time': '18:00'}, ]; - @override Widget build(BuildContext context) { return Wrap( @@ -36,7 +34,7 @@ class _SelectMeetingTimeBottomSheetState padding: EdgeInsets.fromLTRB(24.0.w(), 24.0.h(), 24.0.w(), 33.0.h()), decoration: BoxDecoration( color: AppColors.backgroundColor, - borderRadius: widget.isDialog ? const BorderRadius.all(Radius.circular(16.0)) : const BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0), ), @@ -77,8 +75,9 @@ class _SelectMeetingTimeBottomSheetState SizedBox(height: 8.0.h()), InkWell( onTap: () { - const CompletionOfDocumentsMobileRouteData().push(context); - //context.pop(); + widget.onConfirm(type); + context.pop(); + const CompletionOfDocumentsRouteData().push(context); }, child: Container( width: double.infinity, @@ -118,61 +117,65 @@ class _SelectMeetingTimeBottomSheetState color: isSelected ? AppColors.mainBlue : AppColors.grey40, ), ), - child: InkWell( - onTap: onTap, - child: SizedBox( - width: double.infinity, - height: 40.0.h(), - child: Row( - children: [ - Container( - width: 20.0.w(), - height: 20.0.w(), - margin: EdgeInsets.symmetric( - horizontal: 10.0.w(), - vertical: 10.0.h(), - ), - padding: const EdgeInsets.all(3), - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: isSelected ? AppColors.mainBlue : AppColors.grey70, - width: 2.0, + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: onTap, + child: SizedBox( + width: double.infinity, + height: 40.0.h(), + child: Row( + children: [ + Container( + width: 20.0.w(), + height: 20.0.w(), + margin: EdgeInsets.symmetric( + horizontal: 10.0.w(), + vertical: 10.0.h(), ), - ), - alignment: Alignment.center, - child: Container( + padding: const EdgeInsets.all(3), decoration: BoxDecoration( shape: BoxShape.circle, - color: isSelected ? AppColors.mainBlue : Colors.transparent, + border: Border.all( + color: isSelected ? AppColors.mainBlue : AppColors.grey70, + width: 2.0, + ), + ), + alignment: Alignment.center, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + isSelected ? AppColors.mainBlue : Colors.transparent, + ), ), ), - ), - Expanded( - child: Row( - children: [ - Text( - title, - style: TextStyle( - fontSize: 14.0.sp(), - fontWeight: FontWeight.w500, - color: AppColors.grey80, + Expanded( + child: Row( + children: [ + Text( + title, + style: TextStyle( + fontSize: 14.0.sp(), + fontWeight: FontWeight.w500, + color: AppColors.grey80, + ), ), - ), - const Spacer(), - Text( - time, - style: TextStyle( - fontSize: 14.0.sp(), - fontWeight: FontWeight.w500, - color: AppColors.grey80, + const Spacer(), + Text( + time, + style: TextStyle( + fontSize: 14.0.sp(), + fontWeight: FontWeight.w500, + color: AppColors.grey80, + ), ), - ), - SizedBox(width: 10.0.w()), - ], + SizedBox(width: 10.0.w()), + ], + ), ), - ), - ], + ], + ), ), ), ), diff --git a/lib/views/detail/widgets/meeting_time_dialog.dart b/lib/views/detail/widgets/meeting_time_dialog.dart new file mode 100644 index 0000000..b643684 --- /dev/null +++ b/lib/views/detail/widgets/meeting_time_dialog.dart @@ -0,0 +1,198 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:tm_app/core/routes/app_routes.dart'; +import 'package:tm_app/core/theme/colors.dart'; +import 'package:tm_app/core/utils/size_config.dart'; +import 'package:tm_app/views/detail/strings/tender_details_strings.dart'; + +class MeetingTimeDialog extends StatefulWidget { + const MeetingTimeDialog({required this.onConfirm, super.key}); + final ValueChanged onConfirm; + + @override + State createState() => _MeetingTimeDialogState(); +} + +class _MeetingTimeDialogState extends State { + int selectedType = 0; + late String type = ''; + + final List> times = [ + {'title': 'Sun 2025-06-15', 'value': 'mode1', 'time': '10:00'}, + {'title': 'Sun 2025-06-16', 'value': 'mode2', 'time': '12:00'}, + {'title': 'Sun 2025-06-17', 'value': 'mode3', 'time': '14:00'}, + {'title': 'Sun 2025-06-18', 'value': 'mode4', 'time': '16:00'}, + {'title': 'Sun 2025-06-19', 'value': 'mode5', 'time': '18:00'}, + ]; + + @override + Widget build(BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + side: BorderSide.none, + ), + + insetPadding: const EdgeInsets.symmetric(horizontal: 150), + child: Wrap( + children: [ + Container( + // width: double.infinity, + padding: EdgeInsets.fromLTRB( + 24.0.w(), + 24.0.h(), + 24.0.w(), + 33.0.h(), + ), + + decoration: BoxDecoration( + color: AppColors.backgroundColor, + borderRadius: const BorderRadius.all(Radius.circular(16.0)), + ), + child: Column( + children: [ + Text( + TenderDetailsStrings.meetingTime, + style: TextStyle( + fontSize: 20.0.sp(), + fontWeight: FontWeight.w600, + color: AppColors.grey70, + ), + ), + SizedBox(height: 15.0.h()), + ListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: times.length, + itemBuilder: (context, index) { + final item = times[index]; + return Padding( + padding: EdgeInsets.only(bottom: 8.0.h()), + child: _submissionType( + title: item['title']!, + time: item['time']!, + isSelected: type == item['value'], + onTap: () { + selectedType = index; + type = item['value']!; + setState(() {}); + }, + ), + ); + }, + ), + SizedBox(height: 8.0.h()), + SizedBox(height: 8.0.h()), + Material( + color: Colors.transparent, + child: InkWell( + onTap: () { + widget.onConfirm(type); + context.pop(); + const CompletionOfDocumentsRouteData().push(context); + }, + child: Container( + width: double.infinity, + height: 56.0.h(), + decoration: BoxDecoration( + color: AppColors.primary20, + borderRadius: BorderRadius.circular(100), + ), + alignment: Alignment.center, + child: Text( + TenderDetailsStrings.apply, + style: TextStyle( + fontSize: 14.0.sp(), + fontWeight: FontWeight.w500, + color: AppColors.mainBlue, + ), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ); + } + + Widget _submissionType({ + required VoidCallback onTap, + required String title, + required String time, + required bool isSelected, + }) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + border: Border.all( + color: isSelected ? AppColors.mainBlue : AppColors.grey40, + ), + ), + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: onTap, + child: SizedBox( + width: double.infinity, + height: 40.0.h(), + child: Row( + children: [ + Container( + width: 20.0.w(), + height: 20.0.w(), + margin: EdgeInsets.symmetric( + horizontal: 10.0.w(), + vertical: 10.0.h(), + ), + padding: const EdgeInsets.all(3), + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: isSelected ? AppColors.mainBlue : AppColors.grey70, + width: 2.0, + ), + ), + alignment: Alignment.center, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + isSelected ? AppColors.mainBlue : Colors.transparent, + ), + ), + ), + Expanded( + child: Row( + children: [ + Text( + title, + style: TextStyle( + fontSize: 14.0.sp(), + fontWeight: FontWeight.w500, + color: AppColors.grey80, + ), + ), + const Spacer(), + Text( + time, + style: TextStyle( + fontSize: 14.0.sp(), + fontWeight: FontWeight.w500, + color: AppColors.grey80, + ), + ), + SizedBox(width: 10.0.w()), + ], + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/views/detail/widgets/show_select_meeting_time_bottom_sheet.dart b/lib/views/detail/widgets/show_select_meeting_time_bottom_sheet.dart deleted file mode 100644 index 3b4dd51..0000000 --- a/lib/views/detail/widgets/show_select_meeting_time_bottom_sheet.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tm_app/views/detail/widgets/select_meeting_time_bottom_sheet.dart'; - -Future showSelectMeetingTimeDialog({ - required BuildContext context, - required ValueChanged onConfirm, -}) async { - await showDialog( - context: context, - barrierDismissible: true, - builder: (dialogContext) { - return Dialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), - ), - insetPadding: const EdgeInsets.symmetric(horizontal: 32, vertical: 24), - child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 500), - child: SelectMeetingTimeBottomSheet( - isDialog: true, - onConfirm: (value) { - onConfirm(value); - }, - ), - ), - ); - }, - ); -} diff --git a/lib/views/detail/widgets/tender_detail_action.dart b/lib/views/detail/widgets/tender_detail_action.dart index 6cabbbf..b89acc1 100644 --- a/lib/views/detail/widgets/tender_detail_action.dart +++ b/lib/views/detail/widgets/tender_detail_action.dart @@ -3,30 +3,38 @@ import 'package:provider/provider.dart'; import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/view_models/tender_detail_view_model.dart'; -import 'package:tm_app/views/detail/widgets/select_meeting_time_bottom_sheet.dart'; -import 'package:tm_app/views/detail/widgets/show_select_meeting_time_bottom_sheet.dart'; +import 'package:tm_app/views/detail/widgets/meeting_time_bottom_sheet.dart'; +import 'package:tm_app/views/detail/widgets/meeting_time_dialog.dart'; import 'package:tm_app/views/shared/base_button.dart'; import 'package:tm_app/views/shared/select_submission_bottom_sheet.dart'; import '../../../core/constants/tender_approval_status.dart'; import '../../../core/constants/tender_submision_mode.dart'; import '../../../core/routes/app_routes.dart'; +import '../../../core/utils/app_toast.dart'; import '../../../data/services/model/tender_data/tender_data.dart'; import '../../shared/select_submission_dialog.dart'; import '../strings/tender_details_strings.dart'; -class TenderDetailActions extends StatelessWidget { +class TenderDetailActions extends StatefulWidget { final bool isScreenBig; final TenderData detail; + final TenderDetailViewModel viewModel; const TenderDetailActions({ required this.isScreenBig, required this.detail, + required this.viewModel, super.key, }); + @override + State createState() => _TenderDetailActionsState(); +} + +class _TenderDetailActionsState extends State { @override Widget build(BuildContext context) { - return isScreenBig + return widget.isScreenBig ? _webActions() : Column( children: [ @@ -60,25 +68,34 @@ class TenderDetailActions extends StatelessWidget { onConfirm: (String value) { if (value == TenderSubmissionMode.selfApply.value) { - viewModel.submitTenderApproval( - tenderId: detail.id!, - submissionMode: value, + // viewModel.submitTenderApproval( + // tenderId: widget.detail.id!, + // submissionMode: value, + // ); + + const CompletionOfDocumentsRouteData().push( + context, ); } else if (value == TenderSubmissionMode.partnership.value) { Future.delayed(Duration.zero, () { - showDialog( - context: context, - builder: (context) { - return SelectMeetingTimeBottomSheet( - onConfirm: (String value) { - const CompletionOfDocumentsRouteData() - .push(context); - }, - isDialog: false, - ); - }, - ); + if (context.mounted) { + showModalBottomSheet( + context: context, + + builder: (_) { + return MeetingTimeBottomSheet( + onConfirm: (value) { + AppToast.success( + context, + TenderDetailsStrings + .meetingTimeSuccessfullySet, + ); + }, + ); + }, + ); + } }); } }, @@ -112,7 +129,7 @@ class TenderDetailActions extends StatelessWidget { borderWidth: 1, onPressed: () { viewModel.rejectTenderApproval( - tenderId: detail.id!, + tenderId: widget.detail.id!, submissionMode: TenderSubmissionMode.selfApply.value, ); }, @@ -148,7 +165,7 @@ class TenderDetailActions extends StatelessWidget { borderWidth: 1, onPressed: () { viewModel.rejectTenderApproval( - tenderId: detail.id!, + tenderId: widget.detail.id!, submissionMode: TenderSubmissionMode.selfApply.value, ); }, @@ -177,7 +194,7 @@ class TenderDetailActions extends StatelessWidget { if (viewModel.status == TenderApprovalStatus.submitted.value) { viewModel.submitTenderApproval( - tenderId: detail.id!, + tenderId: widget.detail.id!, submissionMode: TenderSubmissionMode.selfApply.value, ); } else { @@ -189,20 +206,29 @@ class TenderDetailActions extends StatelessWidget { onConfirm: (String value) { if (value == TenderSubmissionMode.selfApply.value) { - const FinalCompletionOfDocumentsRouteData() - .push(context); + if (context.mounted) { + const FinalCompletionOfDocumentsRouteData() + .push(context); + } } else if (value == TenderSubmissionMode.partnership.value) { - WidgetsBinding.instance.addPostFrameCallback(( - timeStamp, - ) { - showSelectMeetingTimeDialog( - context: context, - onConfirm: (String value) { - const CompletionOfDocumentsRouteData() - .push(context); - }, - ); + Future.delayed(Duration.zero, () { + if (context.mounted) { + showDialog( + context: context, + builder: (context) { + return MeetingTimeDialog( + onConfirm: (value) { + AppToast.success( + context, + TenderDetailsStrings + .meetingTimeSuccessfullySet, + ); + }, + ); + }, + ); + } }); } }, @@ -216,22 +242,36 @@ class TenderDetailActions extends StatelessWidget { onConfirm: (String value) { if (value == TenderSubmissionMode.selfApply.value) { - viewModel.submitTenderApproval( - tenderId: detail.id!, - submissionMode: value, - ); + // viewModel.submitTenderApproval( + // tenderId: widget.detail.id!, + // submissionMode: value, + // ); + if (context.mounted) { + const FinalCompletionOfDocumentsRouteData() + .push(context); + } } else if (value == TenderSubmissionMode.partnership.value) { showDialog( context: context, builder: (context) { - return SelectMeetingTimeBottomSheet( - onConfirm: (String value) { - const CompletionOfDocumentsRouteData() - .push(context); + return MeetingTimeBottomSheet( + onConfirm: (value) { + AppToast.success( + context, + TenderDetailsStrings + .meetingTimeSuccessfullySet, + ); }, - isDialog: false, ); + // return MeetingTimeDialog( + // onConfirm: (String value) { + // if (context.mounted) { + // const CompletionOfDocumentsRouteData() + // .push(context); + // } + // }, + // ); }, ); } diff --git a/lib/views/final_completion_of_documents/pages/desktop_final_completion_of_documents_page.dart b/lib/views/final_completion_of_documents/pages/desktop_final_completion_of_documents_page.dart index 01423e5..790dd0c 100644 --- a/lib/views/final_completion_of_documents/pages/desktop_final_completion_of_documents_page.dart +++ b/lib/views/final_completion_of_documents/pages/desktop_final_completion_of_documents_page.dart @@ -23,67 +23,62 @@ class DesktopFinalCompletionOfDocumentsPage extends StatelessWidget { return Scaffold( body: Consumer( builder: - (context, viewModel, child) => SafeArea( - child: Column( - children: [ - const DesktopNavigationWidget(currentIndex: 1), - const SizedBox(height: 64.0), - SizedBox( - width: 740, - child: Column( - children: [ - Expanded( - child: SizedBox( - child: SingleChildScrollView( - child: Column( - children: [ - const TabletDesktopAppbar( - title: - FinalCompletionOfDocumentsStrings - .completionOfDocuments, - ), - SizedBox(height: 32.0.h()), + (context, viewModel, child) => Column( + children: [ + const DesktopNavigationWidget(currentIndex: 1), + const SizedBox(height: 42.0), + Expanded( + child: SingleChildScrollView( + child: SizedBox( + width: double.infinity, + child: Center( + child: SizedBox( + width: 740, + 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: 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: 35.0), + ], ), ), - ], + ), ), ), - ], - ), + ), + ], ), ), );