monthly pay slip improvement

merge-requests/1/merge
Sikander Saleem 3 years ago
parent f1c36b5821
commit 2966ca129c

@ -161,14 +161,14 @@ class Utils {
return base64Decode(base64String); return base64Decode(base64String);
} }
static Widget tableColumnTitle(String? text, {bool showDivider = true}) { static Widget tableColumnTitle(String? text, {bool showDivider = true, bool alignCenter = false}) {
text ??= ""; text ??= "";
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
6.height, 6.height,
text.toText12(), alignCenter ? text.toText12().center : text.toText12(),
5.height, 5.height,
if (showDivider) if (showDivider)
const Divider( const Divider(
@ -180,20 +180,17 @@ class Utils {
); );
} }
static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true}) { static Widget tableColumnValue(String text, { bool isCapitable = true, bool alignCenter = false}) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
12.height, 12.height,
(isCapitable ? text.toLowerCase().capitalizeFirstofEach : text).toText12(color: MyColors.normalTextColor), if (alignCenter)
(isCapitable ? text.toLowerCase().capitalizeFirstofEach : text).toText12(color: MyColors.normalTextColor).center
else
(isCapitable ? text.toLowerCase().capitalizeFirstofEach : text).toText12(color: MyColors.normalTextColor),
12.height, 12.height,
if (!isLast)
const Divider(
height: 1,
color: Color(0xffEFEFEF),
thickness: 1,
)
], ],
); );
} }

@ -99,8 +99,9 @@ class _MonthlyPaySlipScreenState extends State<MonthlyPaySlipScreen> {
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [ children: [
LocaleKeys.month.tr().toText17(isBold: true, color: MyColors.darkIconColor), Container(alignment: Alignment.centerLeft, child: LocaleKeys.month.tr().toText17(isBold: true, color: MyColors.darkIconColor)),
if (selectedMonthIndex != null) if (selectedMonthIndex != null)
Row( Row(
children: [ children: [
@ -158,15 +159,15 @@ class _MonthlyPaySlipScreenState extends State<MonthlyPaySlipScreen> {
TableRow( TableRow(
children: [ children: [
Utils.tableColumnTitle(LocaleKeys.particular.tr()), Utils.tableColumnTitle(LocaleKeys.particular.tr()),
Utils.tableColumnTitle(LocaleKeys.amount.tr()), Utils.tableColumnTitle(LocaleKeys.amount.tr(), alignCenter: true),
], ],
), ),
); );
for (int i = 0; i < earningList.length; i++) { for (int i = 0; i < earningList.length; i++) {
tableRow.add( tableRow.add(
TableRow(children: [ TableRow(children: [
Utils.tableColumnValue('${earningList[i].eLEMENTNAME}', isLast: i == earningList.length - 1), Utils.tableColumnValue('${earningList[i].eLEMENTNAME}'),
Utils.tableColumnValue('${earningList[i].aMOUNT}', isLast: i == earningList.length - 1), Utils.tableColumnValue('${earningList[i].aMOUNT}', alignCenter: true),
]), ]),
); );
} }
@ -190,15 +191,15 @@ class _MonthlyPaySlipScreenState extends State<MonthlyPaySlipScreen> {
TableRow( TableRow(
children: [ children: [
Utils.tableColumnTitle(LocaleKeys.particular.tr()), Utils.tableColumnTitle(LocaleKeys.particular.tr()),
Utils.tableColumnTitle(LocaleKeys.amount.tr()), Utils.tableColumnTitle(LocaleKeys.amount.tr(), alignCenter: true),
], ],
), ),
); );
for (int i = 0; i < deductionList.length; i++) { for (int i = 0; i < deductionList.length; i++) {
tableRow.add( tableRow.add(
TableRow(children: [ TableRow(children: [
Utils.tableColumnValue('${deductionList[i].eLEMENTNAME}', isLast: i == deductionList.length - 1), Utils.tableColumnValue('${deductionList[i].eLEMENTNAME}'),
Utils.tableColumnValue('${deductionList[i].aMOUNT}', isLast: i == deductionList.length - 1), Utils.tableColumnValue('${deductionList[i].aMOUNT}', alignCenter: true),
]), ]),
); );
} }
@ -223,31 +224,31 @@ class _MonthlyPaySlipScreenState extends State<MonthlyPaySlipScreen> {
TableRow( TableRow(
children: [ children: [
Utils.tableColumnTitle(LocaleKeys.particular.tr()), Utils.tableColumnTitle(LocaleKeys.particular.tr()),
Utils.tableColumnTitle("%"), Utils.tableColumnTitle("%", alignCenter: true),
Utils.tableColumnTitle(LocaleKeys.amount.tr()), Utils.tableColumnTitle(LocaleKeys.amount.tr(), alignCenter: true),
], ],
), ),
); );
tableRow.add( tableRow.add(
TableRow(children: [ TableRow(children: [
Utils.tableColumnValue(LocaleKeys.deductions.tr(), isLast: false), Utils.tableColumnValue(LocaleKeys.deductions.tr()),
Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALDEDUCTIONSPERCENTAGE}', isLast: false), Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALDEDUCTIONSPERCENTAGE}', alignCenter: true),
Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALDEDUCTIONSAMOUNT}', isLast: false), Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALDEDUCTIONSAMOUNT}', alignCenter: true),
]), ]),
); );
tableRow.add( tableRow.add(
TableRow(children: [ TableRow(children: [
Utils.tableColumnValue(LocaleKeys.earnings.tr(), isLast: false), Utils.tableColumnValue(LocaleKeys.earnings.tr()),
Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALEARNINGSPERCENTAGE}', isLast: false), Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALEARNINGSPERCENTAGE}', alignCenter: true),
Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALEARNINGSAMOUNT}', isLast: false), Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALEARNINGSAMOUNT}', alignCenter: true),
]), ]),
); );
tableRow.add( tableRow.add(
TableRow(children: [ TableRow(children: [
Utils.tableColumnValue(LocaleKeys.totalPayAmount.tr(), isLast: true), Utils.tableColumnValue(LocaleKeys.totalPayAmount.tr()),
Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALPAYPERCENTAGE}', isLast: true), Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALPAYPERCENTAGE}', alignCenter: true),
Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALPAYAMOUNT}', isLast: true), Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALPAYAMOUNT}', alignCenter: true),
]), ]),
); );

Loading…
Cancel
Save