You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
239 lines
12 KiB
Dart
239 lines
12 KiB
Dart
|
1 month ago
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
||
|
|
import 'package:get/get.dart';
|
||
|
|
|
||
|
|
import '../../../core/constants/app_assets.dart';
|
||
|
|
import '../../../core/constants/form_field_constants.dart';
|
||
|
|
import '../../../core/constants/translation_keys.dart';
|
||
|
|
import '../../../custom_widgets/Fields/input_field.dart';
|
||
|
|
import '../../../custom_widgets/custom_app_bar.dart';
|
||
|
|
import '../../../custom_widgets/custom_button.dart';
|
||
|
|
import '../../../res/app_colors.dart';
|
||
|
|
import '../controllers/new_beneficiary_controller.dart';
|
||
|
|
|
||
|
|
class NewBeneficiaryView extends GetView<NewBeneficiaryController> {
|
||
|
|
const NewBeneficiaryView({Key? key, this.showAppBar = true}) : super(key: key);
|
||
|
|
final bool showAppBar;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
String className = runtimeType.toString().split('.').last;
|
||
|
|
controller.className = className;
|
||
|
|
return Scaffold(
|
||
|
|
appBar: showAppBar
|
||
|
|
? DashBoardAppBar(
|
||
|
|
title: "New Beneficiary",
|
||
|
|
onBackButtonPressed: () {
|
||
|
|
Get.back();
|
||
|
|
controller.clearNewBeneficiaryControllers();
|
||
|
|
},
|
||
|
|
)
|
||
|
|
: null,
|
||
|
|
persistentFooterButtons: [
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||
|
|
child: SizedBox(
|
||
|
|
width: double.infinity,
|
||
|
|
child: CustomButton(
|
||
|
|
buttonColor: AppColors.colorButton,
|
||
|
|
onPressed: () {
|
||
|
|
controller.addToNewBeneficiary();
|
||
|
|
},
|
||
|
|
buttonText: TranslationKeys.makeTranslation(TranslationKeys.textAddToBeneficiary),
|
||
|
|
buttonPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||
|
|
icon: const Icon(Icons.add, size: 18),
|
||
|
|
iconPadding: const EdgeInsets.only(right: 10.0),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
body: SingleChildScrollView(
|
||
|
|
child: Padding(
|
||
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0),
|
||
|
|
child: Obx(() {
|
||
|
|
return Column(
|
||
|
|
children: [
|
||
|
|
// controller.accountTitleField = InputField(
|
||
|
|
// refKey: FormFieldConstants.instance().getFormKey("${className}accountTitleField"),
|
||
|
|
// controller: FormFieldConstants.instance().getController("${className}accountTitleField"),
|
||
|
|
// labelText: "Account Title",
|
||
|
|
// hintText: "Enter your account name",
|
||
|
|
// ),
|
||
|
|
// controller.accountNumberField = InputField(
|
||
|
|
// refKey: FormFieldConstants.instance().getFormKey("${className}accountNumberField"),
|
||
|
|
// controller: FormFieldConstants.instance().getController("${className}accountNumberField"),
|
||
|
|
// labelText: "Account Number",
|
||
|
|
// hintText: "Enter your account number",
|
||
|
|
// ),
|
||
|
|
controller.selectRecipientDetailField = InputField(
|
||
|
|
refKey: FormFieldConstants.instance().getFormKey("${className}selectRecipientDetailField"),
|
||
|
|
controller: FormFieldConstants.instance().getController("${className}selectRecipientDetailField"),
|
||
|
|
labelText: "Recipient Detail",
|
||
|
|
isDropDown: true,
|
||
|
|
hintText: "Select recipient detail",
|
||
|
|
dropDownType: DropDownType.SPECIAL,
|
||
|
|
items: controller.allRecipientDetailOptions,
|
||
|
|
onItemSelected: (item) {
|
||
|
|
controller.updateRecipientDetail(item);
|
||
|
|
},
|
||
|
|
),
|
||
|
|
Column(
|
||
|
|
children: [
|
||
|
|
Visibility(
|
||
|
|
visible: controller.selectedRecipientDetailOption.value.id == controller.OPTION_PHONE,
|
||
|
|
child: Row(
|
||
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
|
children: [
|
||
|
|
Expanded(
|
||
|
|
flex: 8,
|
||
|
|
child: controller.identityPhoneNumberField = InputField(
|
||
|
|
enableInteractiveSelection: false,
|
||
|
|
maxLines: 1,
|
||
|
|
keyboardType: TextInputType.phone,
|
||
|
|
refKey: FormFieldConstants.instance().getFormKey("${className}identityPhoneNumberField"),
|
||
|
|
controller: FormFieldConstants.instance().getController("${className}identityPhoneNumberField"),
|
||
|
|
labelText: TranslationKeys.makeTranslation(TranslationKeys.textPhoneNumber),
|
||
|
|
hintText: "Select phone number",
|
||
|
|
onChanged: (val) {
|
||
|
|
controller.recipientCardNameField.clear();
|
||
|
|
},
|
||
|
|
suffixIcon: SizedBox(
|
||
|
|
width: 70,
|
||
|
|
child: Row(
|
||
|
|
children: [
|
||
|
|
GestureDetector(
|
||
|
|
onTap: () {
|
||
|
|
// controller.scanQr();
|
||
|
|
},
|
||
|
|
child: const Icon(Icons.qr_code, size: 25, color: AppColors.colorPrimary)),
|
||
|
|
const SizedBox(
|
||
|
|
width: 8,
|
||
|
|
),
|
||
|
|
InkWell(
|
||
|
|
customBorder: RoundedRectangleBorder(
|
||
|
|
borderRadius: BorderRadius.circular(50),
|
||
|
|
),
|
||
|
|
onTap: () {
|
||
|
|
controller.selectContact();
|
||
|
|
},
|
||
|
|
child: Padding(
|
||
|
|
padding: const EdgeInsets.all(5.0),
|
||
|
|
child: SvgPicture.asset(AppAssets.ic_select_contact, height: 25, width: 25),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
// readOnly: true,
|
||
|
|
// showCursor: false,
|
||
|
|
onClick: () {
|
||
|
|
// controller.selectContact();
|
||
|
|
},
|
||
|
|
)),
|
||
|
|
const SizedBox(width: 10),
|
||
|
|
Expanded(
|
||
|
|
flex: 2,
|
||
|
|
child: Column(
|
||
|
|
children: [
|
||
|
|
const SizedBox(height: 35),
|
||
|
|
CustomButton(
|
||
|
|
onPressed: () {
|
||
|
|
FocusScope.of(context).requestFocus(FocusNode());
|
||
|
|
controller.verifyAccountAgainstIt();
|
||
|
|
},
|
||
|
|
textStyle: context.textTheme.bodyMedium!.copyWith(fontSize: 11, fontWeight: FontWeight.w500, color: Colors.white),
|
||
|
|
buttonText: TranslationKeys.makeTranslation(TranslationKeys.textVerify),
|
||
|
|
buttonPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
|
||
|
|
buttonColor: AppColors.colorButton),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Visibility(
|
||
|
|
visible: controller.selectedRecipientDetailOption.value.id == controller.OPTION_EMAIL,
|
||
|
|
child: Row(
|
||
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
|
children: [
|
||
|
|
Expanded(
|
||
|
|
flex: 8,
|
||
|
|
child: controller.identityEmailField = InputField(
|
||
|
|
enableInteractiveSelection: false,
|
||
|
|
maxLines: 1,
|
||
|
|
textInputAction: TextInputAction.done,
|
||
|
|
keyboardType: TextInputType.emailAddress,
|
||
|
|
refKey: FormFieldConstants.instance().getFormKey("${className}identityEmailField"),
|
||
|
|
controller: FormFieldConstants.instance().getController("${className}identityEmailField"),
|
||
|
|
labelText: TranslationKeys.makeTranslation(TranslationKeys.textEmail),
|
||
|
|
hintText: "Enter your email",
|
||
|
|
onChanged: (val) {
|
||
|
|
controller.recipientCardNameField.clear();
|
||
|
|
},
|
||
|
|
// readOnly: true,
|
||
|
|
// showCursor: false,
|
||
|
|
onClick: () {
|
||
|
|
// controller.selectContact();
|
||
|
|
},
|
||
|
|
)),
|
||
|
|
const SizedBox(width: 10),
|
||
|
|
Expanded(
|
||
|
|
flex: 2,
|
||
|
|
child: Column(
|
||
|
|
children: [
|
||
|
|
const SizedBox(height: 35),
|
||
|
|
CustomButton(
|
||
|
|
onPressed: () {
|
||
|
|
FocusScope.of(context).requestFocus(FocusNode());
|
||
|
|
controller.verifyAccountAgainstIt();
|
||
|
|
},
|
||
|
|
textStyle: context.textTheme.bodyMedium!.copyWith(fontSize: 11, fontWeight: FontWeight.w500, color: Colors.white),
|
||
|
|
buttonText: TranslationKeys.makeTranslation(TranslationKeys.textVerify),
|
||
|
|
buttonPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
|
||
|
|
buttonColor: AppColors.colorButton),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
controller.recipientCardNameField = InputField(
|
||
|
|
enableInteractiveSelection: false,
|
||
|
|
refKey: FormFieldConstants.instance().getFormKey("${className}recipientCardNameField"),
|
||
|
|
controller: FormFieldConstants.instance().getController("${className}recipientCardNameField"),
|
||
|
|
labelText: TranslationKeys.makeTranslation("Account Title"),
|
||
|
|
hintText: "Account title",
|
||
|
|
readOnly: true,
|
||
|
|
showCursor: false,
|
||
|
|
),
|
||
|
|
controller.nickNameField = InputField(
|
||
|
|
enableInteractiveSelection: false,
|
||
|
|
refKey: FormFieldConstants.instance().getFormKey("${className}nickNameField"),
|
||
|
|
controller: FormFieldConstants.instance().getController("${className}nickNameField"),
|
||
|
|
labelText: "Nick Name",
|
||
|
|
hintText: "Enter your nick name",
|
||
|
|
),
|
||
|
|
// controller.emailIDField = InputField(
|
||
|
|
// refKey: FormFieldConstants.instance().getFormKey("${className}emailIDField"),
|
||
|
|
// controller: FormFieldConstants.instance().getController("${className}emailIDField"),
|
||
|
|
// labelText: "Email ID",
|
||
|
|
// hintText: "Enter your email id",
|
||
|
|
// ),
|
||
|
|
// controller.phoneNumberField = InputField(
|
||
|
|
// refKey: FormFieldConstants.instance().getFormKey("${className}phoneNumberField"),
|
||
|
|
// controller: FormFieldConstants.instance().getController("${className}phoneNumberField"),
|
||
|
|
// labelText: "Phone Number",
|
||
|
|
// keyboardType: TextInputType.number,
|
||
|
|
// hintText: "Enter your phone number",
|
||
|
|
// ),
|
||
|
|
],
|
||
|
|
);
|
||
|
|
}),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|