From 8def0867223edca47b549f0a591190a2d543de11 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Fri, 28 Apr 2023 11:50:58 +0530 Subject: [PATCH 1/3] added horizontal scroll in gpwsc rate card tables --- .../screeens/GpwscDetails/GpwscRateCard.dart | 130 +++++++++--------- 1 file changed, 68 insertions(+), 62 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart b/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart index 8265dacb8..abee3b68b 100644 --- a/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart +++ b/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart @@ -64,85 +64,91 @@ class GpwscRateCard extends StatelessWidget { padding: constraints.maxWidth > 760 ? const EdgeInsets.all(20.0) : const EdgeInsets.all(8.0), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: DataTable( + border: TableBorder.all( + width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), + columns: [ + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.CHARGE_HEAD)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )), + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.CALC_TYPE)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )), + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.BILLING_SLAB)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )), + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )), + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )), + ], + rows: getMeteredRows()), + ), + ); + } + return Padding( + padding: constraints.maxWidth > 760 + ? const EdgeInsets.all(20.0) + : const EdgeInsets.all(8.0), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, child: DataTable( border: TableBorder.all( width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), columns: [ DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.CHARGE_HEAD)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.common.CHARGE_HEAD)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.CALC_TYPE)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.common.CALC_TYPE)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.BILLING_SLAB)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), ], - rows: getMeteredRows()), - ); - } - return Padding( - padding: constraints.maxWidth > 760 - ? const EdgeInsets.all(20.0) - : const EdgeInsets.all(8.0), - child: DataTable( - border: TableBorder.all( - width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), - columns: [ - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.CHARGE_HEAD)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.CALC_TYPE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - ], - rows: ifixHierarchyProvider.wcBillingSlabs!.wCBillingSlabs.where((element) => element.connectionType?.compareTo("Metered")!=0) - .map((slab) => DataRow(cells: [ - DataCell(Text("Water Charges-10101")), - DataCell(Text("${slab.calculationAttribute}")), - DataCell(Text("${slab.buildingType}")), - DataCell(Text("${slab.minimumCharge}")) - ])) - .toList()), + rows: ifixHierarchyProvider.wcBillingSlabs!.wCBillingSlabs.where((element) => element.connectionType?.compareTo("Metered")!=0) + .map((slab) => DataRow(cells: [ + DataCell(Text("Water Charges-10101")), + DataCell(Text("${slab.calculationAttribute}")), + DataCell(Text("${slab.buildingType}")), + DataCell(Text("${slab.minimumCharge}")) + ])) + .toList()), + ), ); } } From d6c87e0ac0adc69937c8c3f59b75e8c2a95c6bdc Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Fri, 28 Apr 2023 12:01:23 +0530 Subject: [PATCH 2/3] added horizontal scroll in gpwsc rate card tables --- .../screeens/GpwscDetails/GpwscRateCard.dart | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart b/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart index abee3b68b..fadf5edaa 100644 --- a/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart +++ b/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart @@ -15,22 +15,30 @@ class GpwscRateCard extends StatelessWidget { Color getColor(Set states) { return Colors.grey.shade200; } - + List getTableTitle(context,constraints,String rateType){ + return [ + LabelText( + "${ApplicationLocalizations.of(context).translate(i18.dashboard.GPWSC_RATE_INFO)}"), + Padding( + padding: (constraints.maxWidth > 760 ? const EdgeInsets.all(15.0) : const EdgeInsets.all(8.0)), + child: Text( + "(${ApplicationLocalizations.of(context).translate(rateType)})", + style: Theme.of(context).textTheme.titleLarge, + textAlign: TextAlign.left, + ), + ), + ]; + } @override Widget build(BuildContext context) { return LayoutBuilder(builder: (context, constraints) { return GpwscCard( children: [ - Row( - children: [ - LabelText( - "${ApplicationLocalizations.of(context).translate(i18.dashboard.GPWSC_RATE_INFO)}"), - Text( - "(${ApplicationLocalizations.of(context).translate(rateType)})", - style: Theme.of(context).textTheme.titleLarge, - textAlign: TextAlign.left, - ), - ], + constraints.maxWidth < 760?Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: getTableTitle(context,constraints,rateType), + ):Row( + children: getTableTitle(context,constraints,rateType), ), Consumer( key: key, From b404280bb8a77786eb724f3b59dddd54be0d0405 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Fri, 28 Apr 2023 12:01:23 +0530 Subject: [PATCH 3/3] localization added --- .../screeens/GpwscDetails/GpwscRateCard.dart | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart b/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart index b24f915f7..0d2bd5e5d 100644 --- a/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart +++ b/frontend/mgramseva/lib/screeens/GpwscDetails/GpwscRateCard.dart @@ -53,24 +53,21 @@ class GpwscRateCard extends StatelessWidget { Widget _getRateCard(String type, IfixHierarchyProvider ifixHierarchyProvider, context, BoxConstraints constraints) { - List getMeteredRows() { + List getMeteredRows(){ List rows = []; - ifixHierarchyProvider.wcBillingSlabs!.wCBillingSlabs - ?.where( - (element) => element.connectionType?.compareTo("Metered") == 0) - .forEach((e) => { - e.slabs?.forEach((slabs) => rows.add(DataRow(cells: [ - DataCell(Text(ApplicationLocalizations.of(context) - .translate(i18.billDetails.WATER_CHARGES_10101))), - DataCell(Text("${e.calculationAttribute}")), - DataCell(Text("${slabs.from}-${slabs.to}")), - DataCell(Text("${e.buildingType}")), - DataCell(Text("${slabs.charge}")) - ]))) - }); + ifixHierarchyProvider.wcBillingSlabs!.wCBillingSlabs?.where((element) => element.connectionType?.compareTo("Metered")==0).forEach((e) =>{ + e.slabs?.forEach((slabs) => + rows.add(DataRow(cells: [ + DataCell(Text("${ApplicationLocalizations.of(context) + .translate(i18.common.WATER_CHARGES)}-10101")), + DataCell(Text("${e.calculationAttribute}")), + DataCell(Text("${slabs.from}-${slabs.to}")), + DataCell(Text("${e.buildingType}")), + DataCell(Text("${slabs.charge}")) + ]))) + }); return rows; } - if (type.compareTo("Metered") == 0) { return Padding( padding: constraints.maxWidth > 760 @@ -129,32 +126,33 @@ class GpwscRateCard extends StatelessWidget { columns: [ DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.CHARGE_HEAD)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.common.CHARGE_HEAD)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.CALC_TYPE)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.common.CALC_TYPE)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), DataColumn( label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", - style: + "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), + )), ], - rows: ifixHierarchyProvider.wcBillingSlabs!.wCBillingSlabs.where((element) => element.connectionType?.compareTo("Metered")!=0) + rows: ifixHierarchyProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType?.compareTo("Metered")!=0) .map((slab) => DataRow(cells: [ - DataCell(Text("Water Charges-10101")), + DataCell(Text("${ApplicationLocalizations.of(context) + .translate(i18.common.WATER_CHARGES)}-10101")), DataCell(Text("${slab.calculationAttribute}")), DataCell(Text("${slab.buildingType}")), DataCell(Text("${slab.minimumCharge}"))