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/u_received/views/u_received_view.dart

263 lines
12 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:uco_mobile_poc/app/core/constants/app_assets.dart';
import 'package:uco_mobile_poc/app/core/constants/form_field_constants.dart';
import 'package:uco_mobile_poc/app/core/constants/translation_keys.dart';
import 'package:uco_mobile_poc/app/custom_widgets/Fields/input_field.dart';
import 'package:uco_mobile_poc/app/custom_widgets/custom_app_bar.dart';
import 'package:uco_mobile_poc/app/custom_widgets/custom_no_record.dart';
import 'package:uco_mobile_poc/app/custom_widgets/custom_text.dart';
import 'package:uco_mobile_poc/app/models/u_recived_responce_model.dart';
import 'package:uco_mobile_poc/app/res/app_colors.dart';
import '../controllers/u_received_controller.dart';
class UReceivedView extends GetView<UReceivedController> {
const UReceivedView({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: TranslationKeys.makeTranslation(
TranslationKeys.textUReceived,
),
onBackButtonPressed: () {
Get.back();
},
)
: null,
body: Obx(() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 0),
child: controller.depositAccountField = InputField(
refKey: FormFieldConstants.instance().getFormKey(
"${className}depositAccountField",
),
controller: FormFieldConstants.instance().getController(
"${className}depositAccountField",
),
labelText: "Select Account",
suffixIcon: const Icon(Icons.keyboard_arrow_down, size: 25),
isDropDown: true,
hintText: "Select account",
dropDownType: DropDownType.SPECIAL,
items: controller.allDepositAccounts,
onItemSelected: (item) {
controller.updateSelectedDeposit(item!);
},
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Text(
TranslationKeys.makeTranslation(
TranslationKeys.textPendingRemittance,
),
style: Theme.of(context).textTheme.bodyMedium,
),
),
controller.uReceivedData.isNotEmpty
? Expanded(
flex: 1,
child: ListView.builder(
itemCount: controller.uReceivedData.length,
itemBuilder: (context, index) {
UReceivedResponseData data =
controller.uReceivedData[index];
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 3.0,
horizontal: 15.0,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(5.0),
),
border: Border.all(
color: AppColors.colorGrey350,
width: 1.5,
),
),
child: ExpansionTile(
collapsedBackgroundColor: Colors.white,
tilePadding: const EdgeInsets.symmetric(
vertical: 0,
horizontal: 10,
),
dense: false,
// onExpansionChanged: controller.toggleExpansion(),
maintainState: true,
expandedAlignment: Alignment.topLeft,
expandedCrossAxisAlignment:
CrossAxisAlignment.start,
childrenPadding: const EdgeInsets.all(10),
//tilePadding: EdgeInsets.all(8.0),
collapsedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
// collapsedBackgroundColor: AppColors.colorGrey350,
shape: const Border(),
backgroundColor: AppColors.white,
leading: Padding(
padding: const EdgeInsets.only(top: 3.0),
child: Text(
"${data.drPcrCurrshort} ${data.sgtGntramt}",
style: Theme.of(context).textTheme.bodyMedium
?.copyWith(
color: AppColors.colorDialogBG,
),
),
),
trailing: const Icon(
Icons.keyboard_arrow_down_outlined,
size: 25,
color: AppColors.colorGrey700,
),
title: Text(
data.drmbmBkmstitle ?? "-",
style: Theme.of(context).textTheme.labelMedium,
),
children: [
Text(
"${data.drPcrCurrshort} ${data.sgtGntramt}",
style: Theme.of(context).textTheme.titleSmall
?.copyWith(color: AppColors.colorButton),
),
const SizedBox(height: 5),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Memo: ",
style: Theme.of(
context,
).textTheme.labelSmall,
),
Expanded(
child: Text(
data.toString(),
style: Theme.of(
context,
).textTheme.labelSmall,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
],
),
const SizedBox(height: 5),
Row(
children: [
Text(
"Sent: ",
style: Theme.of(
context,
).textTheme.labelSmall,
),
Text(
data.drSgtGntrdate.toString(),
style: Theme.of(
context,
).textTheme.labelSmall,
),
],
),
const SizedBox(height: 5),
Text(
"Expires Date: ${data.expSgtGntrdate} ",
style: Theme.of(context).textTheme.labelSmall,
),
const SizedBox(height: 5),
Text(
"Transaction-ID: ${data.sgtSentGntrnumber.toString()}${data.sgtSentNodeId}",
style: Theme.of(context).textTheme.labelSmall,
),
const SizedBox(height: 5),
Text(
"Sender: ${data.drmbmBkmstitle}",
style: Theme.of(context).textTheme.labelSmall,
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () {
controller.reverseTransactionRequest(
data.sgtSentGntrnumber,
data.sgtSentNodeId,
);
},
child: Column(
children: [
SvgPicture.asset(
AppAssets.ic_cross_option,
height: 22,
width: 22,
),
const SizedBox(height: 5),
CustomText(
TranslationKeys.makeTranslation(
TranslationKeys.textReverse,
),
),
],
),
),
const SizedBox(width: 30),
InkWell(
onTap: () {
controller.acceptTransaction(data);
},
child: Column(
children: [
SvgPicture.asset(
AppAssets.ic_tick_option,
height: 22,
width: 22,
),
const SizedBox(height: 5),
CustomText(
TranslationKeys.makeTranslation(
TranslationKeys.textReceived,
),
),
],
),
),
],
),
],
),
),
);
},
),
)
: const Center(
child: CustomNoRecord(
title: "No Record Found",
description:
"We couldn't find any activity at this moment",
),
),
],
);
}),
);
}
}