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.
302 lines
14 KiB
Dart
302 lines
14 KiB
Dart
|
1 month ago
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:get/get.dart';
|
||
|
|
// import 'package:share_plus/share_plus.dart';
|
||
|
|
|
||
|
|
|
||
|
|
import '../../../core/constants/translation_keys.dart';
|
||
|
|
import '../../../core/utils/SessionCache.dart';
|
||
|
|
import '../../../custom_widgets/bottom_sheet.dart';
|
||
|
|
import '../../../custom_widgets/custom_app_bar.dart';
|
||
|
|
import '../../../models/DepositAccountResponse.dart';
|
||
|
|
import '../../../res/app_colors.dart';
|
||
|
|
import '../../app_setting/controllers/app_setting_controller.dart';
|
||
|
|
import '../controllers/my_account_controller.dart';
|
||
|
|
|
||
|
|
class MyAccountView extends GetView<MyAccountController> {
|
||
|
|
const MyAccountView({Key? key}) : super(key: key);
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Scaffold(
|
||
|
|
appBar: DashBoardAppBar(
|
||
|
|
title:
|
||
|
|
TranslationKeys.makeTranslation(TranslationKeys.textMyAccountTitle),
|
||
|
|
onBackButtonPressed: () {
|
||
|
|
Get.back();
|
||
|
|
},
|
||
|
|
),
|
||
|
|
body: Obx(
|
||
|
|
() {
|
||
|
|
return SingleChildScrollView(
|
||
|
|
child: Stack(
|
||
|
|
children: [
|
||
|
|
Container(
|
||
|
|
height: 150,
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color:
|
||
|
|
AppColors.colorButton.withOpacity(0.98),
|
||
|
|
borderRadius: const BorderRadius.only(
|
||
|
|
bottomLeft: Radius.circular(40)))),
|
||
|
|
Column(
|
||
|
|
children: [
|
||
|
|
InkWell(
|
||
|
|
onTap: () {
|
||
|
|
showBottomSheet(context, controller);
|
||
|
|
},
|
||
|
|
child: Card(
|
||
|
|
surfaceTintColor: Colors.white,
|
||
|
|
shape: const RoundedRectangleBorder(
|
||
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||
|
|
),
|
||
|
|
margin: const EdgeInsets.only(
|
||
|
|
left: 10, right: 10, top: 15, bottom: 10),
|
||
|
|
color: Colors.white,
|
||
|
|
elevation: 5.0,
|
||
|
|
child: Container(
|
||
|
|
padding: const EdgeInsets.all(8),
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: AppColors.colorPrimary,
|
||
|
|
border: Border.all(color: AppColors.white),
|
||
|
|
borderRadius: BorderRadius.circular(15.0)),
|
||
|
|
child: ListTile(
|
||
|
|
title: Text(controller.fromAccountTitle.value,
|
||
|
|
style: Theme.of(context)
|
||
|
|
.textTheme
|
||
|
|
.titleSmall
|
||
|
|
?.copyWith(color: AppColors.white)),
|
||
|
|
subtitle: Padding(
|
||
|
|
padding: const EdgeInsets.only(top: 5.0),
|
||
|
|
child: Text(controller.fromAccountNumber.value,
|
||
|
|
style: Theme.of(context)
|
||
|
|
.textTheme
|
||
|
|
.bodySmall
|
||
|
|
?.copyWith(color: AppColors.white)),
|
||
|
|
),
|
||
|
|
trailing: const Icon(
|
||
|
|
Icons.keyboard_arrow_down_sharp,
|
||
|
|
color: AppColors.white,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
const SizedBox(
|
||
|
|
height: 10,
|
||
|
|
),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.symmetric(
|
||
|
|
horizontal: 15.0,
|
||
|
|
),
|
||
|
|
child: Card(
|
||
|
|
surfaceTintColor: Colors.white,
|
||
|
|
shape: const RoundedRectangleBorder(
|
||
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||
|
|
),
|
||
|
|
elevation: 5.0,
|
||
|
|
child: Stack(
|
||
|
|
children: [
|
||
|
|
GestureDetector(
|
||
|
|
onTap: () {
|
||
|
|
String message =
|
||
|
|
'Account Title: ${controller.accountTitleText.value}\nAccount Number: ${controller.accountNumber.value}\nBranch Code: ${controller.branchCode.value}';
|
||
|
|
String subject = 'Subject for sharing';
|
||
|
|
// Share.share(message, subject: subject);
|
||
|
|
},
|
||
|
|
child: Align(
|
||
|
|
alignment: AppSettingController.isRTL.value
|
||
|
|
? Alignment.topLeft
|
||
|
|
: Alignment.topRight,
|
||
|
|
child: const Padding(
|
||
|
|
padding: EdgeInsets.all(10.0),
|
||
|
|
child: CircleAvatar(
|
||
|
|
maxRadius: 10,
|
||
|
|
minRadius: 10,
|
||
|
|
backgroundColor: AppColors.transparent,
|
||
|
|
child: Icon(Icons.share,
|
||
|
|
size: 15, color: AppColors.colorPrimary),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
|
children: [
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(
|
||
|
|
left: 15.0, right: 15.0, top: 10),
|
||
|
|
child: Text(
|
||
|
|
TranslationKeys.makeTranslation(
|
||
|
|
TranslationKeys
|
||
|
|
.textMyAccountAccountTitle),
|
||
|
|
style:
|
||
|
|
Theme.of(context).textTheme.bodyMedium,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
const SizedBox(height: 5),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(
|
||
|
|
left: 15.0, right: 15.0, bottom: 10),
|
||
|
|
child: Text(
|
||
|
|
controller.accountTitleText.value,
|
||
|
|
style:
|
||
|
|
Theme.of(context).textTheme.titleSmall,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(
|
||
|
|
left: 15.0, right: 15.0, top: 10),
|
||
|
|
child: Text(
|
||
|
|
TranslationKeys.makeTranslation(
|
||
|
|
TranslationKeys
|
||
|
|
.textMyAccountAccountNumber),
|
||
|
|
style:
|
||
|
|
Theme.of(context).textTheme.bodyMedium,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Row(
|
||
|
|
children: [
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(
|
||
|
|
left: 15.0, right: 15.0, top: 10),
|
||
|
|
child: Text(
|
||
|
|
controller.accountNumber.value,
|
||
|
|
style: Theme.of(context)
|
||
|
|
.textTheme
|
||
|
|
.titleSmall,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
const SizedBox(width: 20),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
const SizedBox(height: 10),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(
|
||
|
|
left: 15.0, right: 15.0, top: 10),
|
||
|
|
child: Text(
|
||
|
|
TranslationKeys.makeTranslation(
|
||
|
|
TranslationKeys
|
||
|
|
.textMyAccountBranchCode),
|
||
|
|
style: Theme.of(context)
|
||
|
|
.textTheme
|
||
|
|
.bodyMedium),
|
||
|
|
),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(
|
||
|
|
left: 15.0,
|
||
|
|
right: 15.0,
|
||
|
|
top: 10,
|
||
|
|
bottom: 10),
|
||
|
|
child: Text(controller.branchCode.value,
|
||
|
|
style: Theme.of(context)
|
||
|
|
.textTheme
|
||
|
|
.titleSmall),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.symmetric(
|
||
|
|
horizontal: 15.0, vertical: 15.0),
|
||
|
|
child: Card(
|
||
|
|
surfaceTintColor: Colors.white,
|
||
|
|
shape: const RoundedRectangleBorder(
|
||
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||
|
|
),
|
||
|
|
elevation: 5.0,
|
||
|
|
child: SizedBox(
|
||
|
|
height: 60,
|
||
|
|
width: double.infinity,
|
||
|
|
child: Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
|
children: [
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.only(left: 15.0, right: 15),
|
||
|
|
child: Text(
|
||
|
|
TranslationKeys.makeTranslation(
|
||
|
|
TranslationKeys
|
||
|
|
.textMyAccountAccountOpeningDate),
|
||
|
|
style:
|
||
|
|
Theme.of(context).textTheme.bodyMedium),
|
||
|
|
),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||
|
|
child: Text(controller.accountOpeningDate.value,
|
||
|
|
style:
|
||
|
|
Theme.of(context).textTheme.titleSmall),
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
},
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
static void showBottomSheet(
|
||
|
|
BuildContext context, MyAccountController controller) {
|
||
|
|
List<OptionData> options = [];
|
||
|
|
for (int i = 0;
|
||
|
|
i < SessionCache.instance.depositAccountList.value.length;
|
||
|
|
i++) {
|
||
|
|
DepositAccount depositAccount =
|
||
|
|
SessionCache.instance.depositAccountList.value[i];
|
||
|
|
options.add(OptionData.withData(depositAccount.mbmBkmstitle,
|
||
|
|
depositAccount.mbmBkmsnumber, depositAccount));
|
||
|
|
}
|
||
|
|
// for (int i = 0; i < SessionCache.instance.loanAccountList.length; i++) {
|
||
|
|
// LoanAccount loanAccount = SessionCache.instance.loanAccountList[i];
|
||
|
|
// options.add(OptionData.withData(
|
||
|
|
// loanAccount.mbmBkmstitle, loanAccount.mbmBkmsnumber, loanAccount));
|
||
|
|
// }
|
||
|
|
|
||
|
|
Get.bottomSheet(
|
||
|
|
Container(
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: Colors.white,
|
||
|
|
border: Border.all(color: AppColors.colorGrey800, width: 1),
|
||
|
|
borderRadius: const BorderRadius.only(
|
||
|
|
topLeft: Radius.circular(30), topRight: Radius.circular(30))),
|
||
|
|
margin: const EdgeInsets.only(left: 20, right: 20),
|
||
|
|
child: DialogDesign(options, (selectedOption) {
|
||
|
|
if (selectedOption.dataObject is DepositAccount) {
|
||
|
|
DepositAccount selectAccount =
|
||
|
|
selectedOption.dataObject as DepositAccount;
|
||
|
|
controller.fromAccountTitle.value = selectAccount.mbmBkmstitle;
|
||
|
|
controller.fromAccountNumber.value = selectAccount.mbmBkmsnumber;
|
||
|
|
controller.accountTitleText.value = selectAccount.mbmBkmstitle;
|
||
|
|
controller.accountNumber.value = selectAccount.mbmBkmsnumber;
|
||
|
|
// controller.branchCode.value = selectAccount.plcLocadesc;
|
||
|
|
controller.accountOpeningDate.value = selectAccount.mbmBkmsopendate;
|
||
|
|
}
|
||
|
|
// if (selectedOption.dataObject is LoanAccount) {
|
||
|
|
// LoanAccount selectAccount =
|
||
|
|
// selectedOption.dataObject as LoanAccount;
|
||
|
|
// controller.fromAccountTitle.value = selectAccount.mbmBkmstitle;
|
||
|
|
// controller.fromAccountNumber.value = selectAccount.mbmBkmsnumber;
|
||
|
|
// controller.accountTitleText.value = selectAccount.mbmBkmstitle;
|
||
|
|
// controller.accountNumber.value = selectAccount.mbmBkmsnumber;
|
||
|
|
// controller.branchCode.value = selectAccount.plcLocadesc;
|
||
|
|
// controller.accountOpeningDate.value = selectAccount.mbmBkmsopendate;
|
||
|
|
// }
|
||
|
|
}),
|
||
|
|
),
|
||
|
|
backgroundColor: Colors.transparent,
|
||
|
|
isScrollControlled: true,
|
||
|
|
shape: const RoundedRectangleBorder(
|
||
|
|
borderRadius: BorderRadius.only(
|
||
|
|
topLeft: Radius.circular(10), topRight: Radius.circular(10))),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|