|
|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
|
|
|
|
@ -20,6 +22,7 @@ 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/image_picker.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/radio_list_tile_widget.dart';
|
|
|
|
|
@ -293,6 +296,33 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
if (vm.selectedWithdrawMethod == RefundTabType.cash) ...[
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: BorderRadius.circular(24.r),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Utils.buildSvgWithAssets(
|
|
|
|
|
icon: AppAssets.alertSquare,
|
|
|
|
|
height: 24.h,
|
|
|
|
|
width: 24.h,
|
|
|
|
|
iconColor: AppColors.textColor,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 12.w),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: LocaleKeys.cashRefundApprovalInstructions.tr(context: context).toText12(
|
|
|
|
|
color: AppColors.greyInfoTextColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -329,7 +359,7 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
if (isStep2 && vm.selectedAdvance != null) ...[
|
|
|
|
|
if (vm.selectedAdvance != null) ...[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.fromLTRB(24.w, 16.h, 24.w, 0),
|
|
|
|
|
child: Row(
|
|
|
|
|
@ -351,7 +381,8 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
CustomButton(
|
|
|
|
|
text: isStep2 ? LocaleKeys.submitRequest.tr(context: context) : LocaleKeys.next.tr(context: context),
|
|
|
|
|
icon: isStep2 ? AppAssets.refundIcon : null,
|
|
|
|
|
text: isStep2 ? LocaleKeys.submit.tr(context: context) : LocaleKeys.next.tr(context: context),
|
|
|
|
|
isDisabled: isStep2 ? !isStep2Valid : !isStep1Valid,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (!isStep2) {
|
|
|
|
|
@ -525,6 +556,160 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ── Image Upload Section ──────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
Widget _buildImageUploadSection(HabibWalletViewModel vm) {
|
|
|
|
|
return Consumer<HabibWalletViewModel>(
|
|
|
|
|
builder: (context, viewModel, _) {
|
|
|
|
|
final hasError = viewModel.withdrawAttachmentError != null;
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// Upload button
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (viewModel.withdrawAttachmentList.length >= 4) {
|
|
|
|
|
viewModel.setWithdrawAttachmentError(LocaleKeys.maximumFilesReached.tr(context: context));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ImageOptions.showImageOptionsNew(
|
|
|
|
|
context,
|
|
|
|
|
true,
|
|
|
|
|
(String base64Image, File file) async {
|
|
|
|
|
// Validate file size (2MB max)
|
|
|
|
|
final fileSize = await file.length();
|
|
|
|
|
if (fileSize > HabibWalletViewModel.maxFileSizeBytes) {
|
|
|
|
|
viewModel.setWithdrawAttachmentError(LocaleKeys.fileSizeTooLarge.tr(context: context));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check max files limit
|
|
|
|
|
if (viewModel.withdrawAttachmentList.length >= HabibWalletViewModel.maxAttachments) {
|
|
|
|
|
viewModel.setWithdrawAttachmentError(LocaleKeys.maximumFilesReached.tr(context: context));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add attachment
|
|
|
|
|
viewModel.addWithdrawAttachment(base64Image);
|
|
|
|
|
},
|
|
|
|
|
title: LocaleKeys.selectAttachment.tr(context: context),
|
|
|
|
|
allowMultiple: true, // Enable multiple selection
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: BorderRadius.circular(24.r),
|
|
|
|
|
border: hasError ? Border.all(color: AppColors.primaryRedBorderColor, width: 1) : null,
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: 40.h,
|
|
|
|
|
width: 40.h,
|
|
|
|
|
padding: EdgeInsets.all(8.h),
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
color: AppColors.greyColor,
|
|
|
|
|
),
|
|
|
|
|
child: Utils.buildSvgWithAssets(icon: AppAssets.selectImageIcon, applyThemeColor: false),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 12.w),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.uploadImage.tr(context: context).toText12(
|
|
|
|
|
color: AppColors.inputLabelTextColor,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.selectImage.tr(context: context).toText14(
|
|
|
|
|
color: AppColors.inputLabelTextColor,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (hasError) ...[
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
viewModel.withdrawAttachmentError!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 12.f,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down, width: 25.h, height: 25.h),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// Selected images list
|
|
|
|
|
if (viewModel.withdrawAttachmentList.isNotEmpty) ...[
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: 24.r,
|
|
|
|
|
hasShadow: false,
|
|
|
|
|
),
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: viewModel.withdrawAttachmentList.length,
|
|
|
|
|
separatorBuilder: (context, index) => SizedBox(height: 12.h),
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.attach_file,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
size: 20.h,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 8.w),
|
|
|
|
|
"${LocaleKeys.image.tr(context: context)} ${index + 1}".toText14(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Utils.buildSvgWithAssets(icon: AppAssets.cancel_circle_icon, width: 20.h, height: 20.h).onPress(() {
|
|
|
|
|
viewModel.removeWithdrawAttachment(index);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ── Submit ────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
void _handleWalletWithdrawalSubmit(HabibWalletViewModel vm) {
|
|
|
|
|
@ -718,6 +903,10 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
_buildBankInputDetails(),
|
|
|
|
|
],
|
|
|
|
|
if (habibWalletViewModel.selectedWithdrawMethod != null) ...[
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
_buildImageUploadSection(habibWalletViewModel),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|