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.
uco-mobile-poc/lib/app/modules/user_profile/views/account_details_view.dart

122 lines
4.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:share_plus/share_plus.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 '../../../res/app_colors.dart';
import '../controllers/user_profile_controller.dart';
import 'profile_details_view.dart';
class AccountDetailsView extends GetView<UserProfileController> {
const AccountDetailsView({super.key});
@override
Widget build(BuildContext context) {
String className = runtimeType
.toString()
.split('.')
.last;
return Scaffold(
appBar: DashBoardAppBar(
title: TranslationKeys.makeTranslation("Account Detail"),
onBackButtonPressed: () {
Get.back();
},
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(left: 14, right: 21),
child: Obx(() {
return Column(
children: [
controller.depositAccountField = InputField(
refKey: FormFieldConstants.instance().getFormKey("${className}depositAccountField"),
controller: FormFieldConstants.instance().getController("${className}depositAccountField"),
labelText: "Select From Account",
suffixIcon: const Icon(Icons.keyboard_arrow_down, size: 25),
isDropDown: true,
hintText: "Select from account",
dropDownType: DropDownType.SPECIAL,
items: controller.allDepositAccounts,
inputColor: Colors.black,
onItemSelected: (item) {
controller.updateSelectedDeposit(item!);
},
),
const SizedBox(height: 20),
ProfileDetailsTile(
title: 'Personal Details',
subtitle: controller.selectedDepositAccount.value.mbmBkmstitle.isEmpty ? "----" : controller.selectedDepositAccount.value.mbmBkmstitle,
),
ProfileDetailsTile(
title: 'Account Number',
subtitle: controller.selectedDepositAccount.value.mbmBkmsnumber.isEmpty ? "----" : controller.selectedDepositAccount.value.mbmBkmsnumber,
widget: shareButton(
() {
String message = 'Account Number: ${controller.selectedDepositAccount.value.mbmBkmsnumber}';
String subject = 'Subject for sharing';
Share.share(message, subject: subject);
},
),
),
ProfileDetailsTile(
title: 'IBAN Number',
subtitle: controller.selectedDepositAccount.value.mbmBkmsnumber.isEmpty ? "----" : controller.selectedDepositAccount.value.mbmBkmsnumber,
widget: shareButton(
() {
String message = 'IBAN Number: ${controller.selectedDepositAccount.value.mbmBkmsnumber}';
String subject = 'Subject for sharing';
Share.share(message, subject: subject);
},
),
),
ProfileDetailsTile(
title: 'Account Opening Date',
subtitle: controller.selectedDepositAccount.value.mbmBkmsopendate.isEmpty ? "----" : controller.selectedDepositAccount.value.mbmBkmsopendate,
),
ProfileDetailsTile(
title: 'Currency',
subtitle: controller.selectedDepositAccount.value.pcrCurrshort.isEmpty ? "----" :controller.selectedDepositAccount.value.pcrCurrshort,
),
],
);
}),
),
),
);
}
GestureDetector shareButton(Function()? onTap) {
return GestureDetector(
onTap: onTap,
child: Container(
width: 80,
decoration: BoxDecoration(
color: AppColors.f0f0f0,
border: Border.all(
color: AppColors.c0c0c0,
),
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.all(4),
child: Row(
children: [
const SizedBox(width: 12),
Text(
TranslationKeys.makeTranslation(TranslationKeys.textShare),
style: Get.context!.textTheme.bodyMedium!.copyWith(fontSize: 11, fontWeight: FontWeight.w400),
),
const SizedBox(width: 7),
const Icon(Icons.share, size: 12, color: AppColors.colorPrimary),
const SizedBox(width: 4),
],
),
),
);
}
}