diff --git a/lib/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart b/lib/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart index bad8006..c014bee 100644 --- a/lib/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart +++ b/lib/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart @@ -76,6 +76,8 @@ class AncillaryOrderItem { bool? isQueued; DateTime? orderDate; int? orderNo; + String? projectName; // Added from parent AncillaryOrderGroup + int? projectID; // Added from parent AncillaryOrderGroup AncillaryOrderItem({ this.ancillaryProcedureListModels, @@ -90,9 +92,11 @@ class AncillaryOrderItem { this.isQueued, this.orderDate, this.orderNo, + this.projectName, + this.projectID, }); - factory AncillaryOrderItem.fromJson(Map json) => AncillaryOrderItem( + factory AncillaryOrderItem.fromJson(Map json, {String? projectName, int? projectID}) => AncillaryOrderItem( ancillaryProcedureListModels: json['AncillaryProcedureListModels'], appointmentDate: DateUtil.convertStringToDate(json['AppointmentDate']), appointmentNo: json['AppointmentNo'] as int?, @@ -105,5 +109,7 @@ class AncillaryOrderItem { isQueued: json['IsQueued'] as bool?, orderDate: DateUtil.convertStringToDate(json['OrderDate']), orderNo: json['OrderNo'] as int?, + projectName: projectName, + projectID: projectID, ); } diff --git a/lib/features/todo_section/todo_section_repo.dart b/lib/features/todo_section/todo_section_repo.dart index 60754e2..008b22c 100644 --- a/lib/features/todo_section/todo_section_repo.dart +++ b/lib/features/todo_section/todo_section_repo.dart @@ -81,11 +81,13 @@ class TodoSectionRepoImp implements TodoSectionRepo { for (var group in groupsList) { if (group is Map && group['AncillaryOrderList'] != null) { final ordersList = group['AncillaryOrderList'] as List; + final projectName = group['ProjectName'] as String?; + final projectID = group['ProjectID'] as int?; // Parse each order item in the group for (var orderJson in ordersList) { if (orderJson is Map) { - ancillaryOrders.add(AncillaryOrderItem.fromJson(orderJson)); + ancillaryOrders.add(AncillaryOrderItem.fromJson(orderJson, projectName: projectName, projectID: projectID)); } } } diff --git a/lib/features/todo_section/todo_section_view_model.dart b/lib/features/todo_section/todo_section_view_model.dart index 0d97828..c0fb96b 100644 --- a/lib/features/todo_section/todo_section_view_model.dart +++ b/lib/features/todo_section/todo_section_view_model.dart @@ -223,9 +223,7 @@ class TodoSectionViewModel extends ChangeNotifier { Function(dynamic)? onSuccess, Function(String)? onError, }) async { - final result = await todoSectionRepo.applePayInsertRequest( - applePayInsertRequest: applePayInsertRequest, - ); + final result = await todoSectionRepo.applePayInsertRequest(applePayInsertRequest: applePayInsertRequest); result.fold( (failure) async { diff --git a/lib/presentation/prescriptions/prescription_detail_page.dart b/lib/presentation/prescriptions/prescription_detail_page.dart index 473f79a..e0e78c2 100644 --- a/lib/presentation/prescriptions/prescription_detail_page.dart +++ b/lib/presentation/prescriptions/prescription_detail_page.dart @@ -13,15 +13,13 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_item_view.dart'; -import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_reminder_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; -import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart'; import 'package:open_filex/open_filex.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -127,7 +125,8 @@ class _PrescriptionDetailPageState extends State { children: [ AppCustomChipWidget( icon: AppAssets.doctor_calendar_icon, - labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.prescriptionsResponseModel.appointmentDate), false), + labelText: DateUtil.formatDateToDate( + DateUtil.convertStringToDate(widget.prescriptionsResponseModel.appointmentDate), false), labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h), ), AppCustomChipWidget( @@ -214,18 +213,22 @@ class _PrescriptionDetailPageState extends State { hasShadow: true, ), child: CustomButton( - text: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? LocaleKeys.resendOrder.tr(context: context) : LocaleKeys.prescriptionDeliveryError.tr(context: context), + text: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! + ? LocaleKeys.resendOrder.tr(context: context) + : LocaleKeys.prescriptionDeliveryError.tr(context: context), onPressed: () {}, backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.greyF7Color, borderColor: AppColors.successColor.withOpacity(0.01), - textColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35), + textColor: + widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35), fontSize: 16, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 50.h, icon: AppAssets.prescription_refill_icon, - iconColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35), + iconColor: + widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35), iconSize: 20.h, ).paddingSymmetrical(24.h, 24.h), ), diff --git a/lib/presentation/todo_section/ancillary_order_payment_page.dart b/lib/presentation/todo_section/ancillary_order_payment_page.dart index 65ab778..f9995dc 100644 --- a/lib/presentation/todo_section/ancillary_order_payment_page.dart +++ b/lib/presentation/todo_section/ancillary_order_payment_page.dart @@ -2,25 +2,35 @@ import 'dart:async'; import 'dart:developer'; import 'dart:io'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/cache_consts.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart'; import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_procedures_detail_response_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/in_app_browser/InAppBrowser.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; class AncillaryOrderPaymentPage extends StatefulWidget { + final DateTime? appointmentDate; final int appointmentNoVida; final int orderNo; final int projectID; @@ -29,6 +39,7 @@ class AncillaryOrderPaymentPage extends StatefulWidget { const AncillaryOrderPaymentPage({ super.key, + required this.appointmentDate, required this.appointmentNoVida, required this.orderNo, required this.projectID, @@ -171,7 +182,7 @@ class _AncillaryOrderPaymentPageState extends State { ), // Payment Summary Footer - todoVM.isProcessingPayment ? SizedBox.shrink() : _buildPaymentSummary(), + todoVM.isProcessingPayment ? SizedBox.shrink() : _buildPaymentSummary() ], ); }, @@ -256,7 +267,7 @@ class _AncillaryOrderPaymentPageState extends State { fit: BoxFit.contain, ).paddingSymmetrical(24.h, 0.h).onPress(() { if (!todoSectionViewModel.isProcessingPayment) { - _openPaymentURL("ApplePay"); + _startApplePay(); } }) : SizedBox(height: 12.h), @@ -474,11 +485,160 @@ class _AncillaryOrderPaymentPageState extends State { // Show success message and navigate Utils.showToast("Payment successful! Invoice #: $invoiceNo"); - // Navigate back to home after a short delay - Future.delayed(Duration(seconds: 2), () { - Navigator.of(context).pop(); // Close payment page - Navigator.of(context).pop(); // Close details page + Future.delayed(Duration(seconds: 1), () { + showCommonBottomSheetWithoutHeight( + context, + child: Column( + children: [ + Row( + children: [ + "Here is your invoice #: ".needTranslation.toText14( + color: AppColors.textColorLight, + weight: FontWeight.w500, + ), + SizedBox(width: 4.w), + ("12345").toText16(isBold: true), + ], + ), + SizedBox(height: 24.h), + Row( + children: [ + Expanded( + child: CustomButton( + height: 56.h, + text: LocaleKeys.ok.tr(), + onPressed: () { + Navigator.pushAndRemoveUntil( + context, + CustomPageRoute( + page: LandingNavigation(), + ), + (r) => false); + }, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + ), + ), + ], + ), + ], + ), + // title: "Payment Completed Successfully".needTranslation, + titleWidget: Utils.getSuccessWidget(loadingText: "Payment Completed Successfully".needTranslation), + isCloseButtonVisible: false, + isDismissible: false, + isFullScreen: false, + ); }); } + + _startApplePay() async { + showCommonBottomSheet( + context, + child: Utils.getLoadingWidget(), + callBackFunc: (str) {}, + title: "", + height: ResponsiveExtension.screenHeight * 0.3, + isCloseButtonVisible: false, + isDismissible: false, + isFullScreen: false, + ); + final user = appState.getAuthenticatedUser(); + transID = Utils.getAdvancePaymentTransID(widget.projectID, user!.patientId!); + + ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest(); + await payfortViewModel.getPayfortConfigurations( + serviceId: ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum(), + projectId: widget.projectID, + integrationId: 2, + ); + + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = 0; + + applePayInsertRequest.currency = appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED"; + applePayInsertRequest.customerEmail = "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com"; + applePayInsertRequest.customerID = appState.getAuthenticatedUser()!.patientId.toString(); + applePayInsertRequest.customerName = "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}"; + + applePayInsertRequest.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken); + applePayInsertRequest.voipToken = await Utils.getStringFromPrefs(CacheConst.voipToken); + applePayInsertRequest.doctorID = 0; + applePayInsertRequest.projectID = widget.projectID.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = appState.getAuthenticatedUser()!.patientId.toString(); + applePayInsertRequest.patientTypeID = appState.getAuthenticatedUser()!.patientType; + applePayInsertRequest.patientOutSA = appState.getAuthenticatedUser()!.outSa; + applePayInsertRequest.appointmentDate = DateUtil.convertDateToString(widget.appointmentDate ?? DateTime.now()); + applePayInsertRequest.appointmentNo = widget.appointmentNoVida; + applePayInsertRequest.orderDescription = "Ancillary Order Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = widget.totalAmount.toString(); + applePayInsertRequest.isSchedule = "0"; + applePayInsertRequest.language = appState.isArabic() ? 'ar' : 'en'; + applePayInsertRequest.languageID = appState.isArabic() ? 1 : 2; + applePayInsertRequest.userName = appState.getAuthenticatedUser()!.patientId; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature; + applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse; + applePayInsertRequest.returnURL = ""; + + try { + await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest); + } catch (error) { + log("Apple Pay Insert Request Failed: $error"); + Navigator.of(context).pop(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: "Failed to initialize Apple Pay. Please try again.".needTranslation), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + return; + } + // Only proceed with Apple Pay if insert was successful + payfortViewModel.paymentWithApplePay( + customerName: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}", + customerEmail: "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com", + orderDescription: "Ancillary Order Payment", + orderAmount: widget.totalAmount, + merchantReference: transID, + merchantIdentifier: payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier, + applePayAccessCode: payfortViewModel.payfortProjectDetailsRespModel!.accessCode, + applePayShaRequestPhrase: payfortViewModel.payfortProjectDetailsRespModel!.shaRequest, + currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED", + onFailed: (failureResult) async { + log("failureResult: ${failureResult.message.toString()}"); + Navigator.of(context).pop(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: failureResult.message.toString()), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }, + onSucceeded: (successResult) async { + Navigator.of(context).pop(); + log("successResult: ${successResult.responseMessage.toString()}"); + selectedPaymentMethod = successResult.paymentOption ?? "VISA"; + _checkPaymentStatus(); + }, + ); + } } diff --git a/lib/presentation/todo_section/ancillary_procedures_details_page.dart b/lib/presentation/todo_section/ancillary_procedures_details_page.dart index 71e7782..449d21e 100644 --- a/lib/presentation/todo_section/ancillary_procedures_details_page.dart +++ b/lib/presentation/todo_section/ancillary_procedures_details_page.dart @@ -23,23 +23,25 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; -class AncillaryProceduresDetailsList extends StatefulWidget { +class AncillaryOrderDetailsList extends StatefulWidget { final int appointmentNoVida; final int orderNo; final int projectID; + final String projectName; - const AncillaryProceduresDetailsList({ + const AncillaryOrderDetailsList({ super.key, required this.appointmentNoVida, required this.orderNo, required this.projectID, + required this.projectName, }); @override - State createState() => _AncillaryProceduresDetailsListState(); + State createState() => _AncillaryOrderDetailsListState(); } -class _AncillaryProceduresDetailsListState extends State { +class _AncillaryOrderDetailsListState extends State { late TodoSectionViewModel todoSectionViewModel; late AppState appState; List selectedProcedures = []; @@ -77,6 +79,7 @@ class _AncillaryProceduresDetailsListState extends State { onCheckIn: (order) => log("Check-in for order: ${order.orderNo}"), onViewDetails: (order) async { Navigator.of(context).push(CustomPageRoute( - page: AncillaryProceduresDetailsList( + page: AncillaryOrderDetailsList( appointmentNoVida: order.appointmentNo ?? 0, orderNo: order.orderNo ?? 0, - projectID: 15, - // TODO: NEED to Confirm about projectID + projectID: order.projectID ?? 0, + projectName: order.projectName ?? "", ))); log("View details for order: ${order.orderNo}"); }, diff --git a/lib/presentation/todo_section/widgets/ancillary_orders_list.dart b/lib/presentation/todo_section/widgets/ancillary_orders_list.dart index a1c99d9..31a778f 100644 --- a/lib/presentation/todo_section/widgets/ancillary_orders_list.dart +++ b/lib/presentation/todo_section/widgets/ancillary_orders_list.dart @@ -114,33 +114,42 @@ class AncillaryOrderCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ // Header Row with Order Number and Date - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - if (!isLoading) - "Order #".needTranslation.toText14( - color: AppColors.textColorLight, - weight: FontWeight.w500, - ), - SizedBox(width: 4.w), - (isLoading ? "12345" : "${order.orderNo ?? '-'}").toText16(isBold: true).toShimmer2(isShow: isLoading), - ], - ), - if (order.orderDate != null || isLoading) - (isLoading ? "Jan 15, 2024" : DateFormat('MMM dd, yyyy').format(order.orderDate!)) - .toText12(color: AppColors.textColorLight) - .toShimmer2(isShow: isLoading), - ], - ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Row( + // children: [ + // if (!isLoading) + // "Order #".needTranslation.toText14( + // color: AppColors.textColorLight, + // weight: FontWeight.w500, + // ), + // SizedBox(width: 4.w), + // (isLoading ? "12345" : "${order.orderNo ?? '-'}").toText16(isBold: true).toShimmer2(isShow: isLoading), + // ], + // ), + // if (order.orderDate != null || isLoading) + // (isLoading ? "Jan 15, 2024" : DateFormat('MMM dd, yyyy').format(order.orderDate!)) + // .toText12(color: AppColors.textColorLight) + // .toShimmer2(isShow: isLoading), + // ], + // ), SizedBox(height: 12.h), // Doctor and Clinic Info Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ + if (!isLoading) ...[ + Image.network( + "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", + width: 40.w, + height: 40.h, + fit: BoxFit.cover, + ).circle(100.r), + SizedBox(width: 12.w), + ], Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -153,17 +162,6 @@ class AncillaryOrderCard extends StatelessWidget { .toShimmer2(isShow: isLoading), SizedBox(height: 4.h), - - // Clinic Name - if (order.clinicName != null || isLoading) - (isLoading ? "Cardiology Clinic" : order.clinicName!) - .toString() - .toText12( - fontWeight: FontWeight.w500, - color: AppColors.greyTextColor, - maxLine: 2, - ) - .toShimmer2(isShow: isLoading), ], ), ), @@ -178,6 +176,18 @@ class AncillaryOrderCard extends StatelessWidget { spacing: 3.h, runSpacing: 4.h, children: [ + // projectName + if (order.projectName != null || isLoading) + AppCustomChipWidget( + labelText: order.projectName ?? '-', + ).toShimmer2(isShow: isLoading), + // orderNo + if (order.orderNo != null || isLoading) + AppCustomChipWidget( + // icon: AppAssets.calendar, + labelText: "${"Order# :".needTranslation}${order.orderNo ?? '-'}", + ).toShimmer2(isShow: isLoading), + // Appointment Date if (order.appointmentDate != null || isLoading) AppCustomChipWidget( @@ -189,7 +199,7 @@ class AncillaryOrderCard extends StatelessWidget { // Appointment Number if (order.appointmentNo != null || isLoading) AppCustomChipWidget( - labelText: isLoading ? "Appt #: 98765" : "Appt #: ${order.appointmentNo}".needTranslation, + labelText: isLoading ? "Appt# : 98765" : "Appt #: ${order.appointmentNo}".needTranslation, ).toShimmer2(isShow: isLoading), // Invoice Number @@ -261,8 +271,6 @@ class AncillaryOrderCard extends StatelessWidget { borderRadius: 10.r, padding: EdgeInsets.fromLTRB(10.h, 0, 10.h, 0), height: 40.h, - icon: AppAssets.arrow_forward, - iconColor: AppColors.primaryRedColor, iconSize: 15.h, ).toShimmer2(isShow: isLoading), ), diff --git a/lib/widgets/buttons/custom_button.dart b/lib/widgets/buttons/custom_button.dart index 03db819..b823eae 100644 --- a/lib/widgets/buttons/custom_button.dart +++ b/lib/widgets/buttons/custom_button.dart @@ -67,7 +67,7 @@ class CustomButton extends StatelessWidget { color: isDisabled ? backgroundColor.withValues(alpha: .5) : backgroundColor, borderRadius: radius, customBorder: BorderRadius.circular(radius), - side: borderSide ?? BorderSide(width: borderWidth.h, color: isDisabled ? borderColor.withValues(alpha: 0.5) : borderColor)), + side: borderSide ?? BorderSide(width: borderWidth.h, color: borderColor)), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/widgets/common_bottom_sheet.dart b/lib/widgets/common_bottom_sheet.dart index 4d0dcf1..1d857b5 100644 --- a/lib/widgets/common_bottom_sheet.dart +++ b/lib/widgets/common_bottom_sheet.dart @@ -105,15 +105,15 @@ class ButtonSheetContent extends StatelessWidget { } void showCommonBottomSheetWithoutHeight( - BuildContext context, { - required Widget child, - required VoidCallback callBackFunc, - String title = "", - bool isCloseButtonVisible = true, - bool isFullScreen = true, - bool isDismissible = true, - Widget? titleWidget, - bool useSafeArea = false, + BuildContext context, { + required Widget child, + VoidCallback? callBackFunc, + String title = "", + bool isCloseButtonVisible = true, + bool isFullScreen = true, + bool isDismissible = true, + Widget? titleWidget, + bool useSafeArea = false, bool hasBottomPadding = true, Color backgroundColor = AppColors.bottomSheetBgColor, }) { @@ -143,13 +143,12 @@ void showCommonBottomSheetWithoutHeight( ), child: SingleChildScrollView( physics: ClampingScrollPhysics(), - child: isCloseButtonVisible - ? Container( + child: Container( padding: EdgeInsets.only( - left: 24, - top: 24, - right: 24, - bottom: 12, + left: 24.w, + top: 24.h, + right: 24.w, + bottom: 12.h, ), decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.bottomSheetBgColor, @@ -157,6 +156,7 @@ void showCommonBottomSheetWithoutHeight( ), child: Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -166,26 +166,29 @@ void showCommonBottomSheetWithoutHeight( Expanded( child: title.toText20(weight: FontWeight.w600), ), - Utils.buildSvgWithAssets( - icon: AppAssets.close_bottom_sheet_icon, - iconColor: Color(0xff2B353E), - ).onPress(() { - Navigator.of(context).pop(); - }), + if (isCloseButtonVisible) ...[ + Utils.buildSvgWithAssets( + icon: AppAssets.close_bottom_sheet_icon, + iconColor: Color(0xff2B353E), + ).onPress(() { + Navigator.of(context).pop(); + }), + ], ], ), SizedBox(height: 16.h), child, ], ), - ) - : child, + ), ), ), ); }, ).then((value) { - callBackFunc(); + if (callBackFunc != null) { + callBackFunc(); + } }); }