From 11cf322064060bb9d8278836453e2b6b72a85961 Mon Sep 17 00:00:00 2001 From: naveen-egov Date: Tue, 21 Dec 2021 16:54:12 +0530 Subject: [PATCH 1/2] replaced <...> with {...} --- .../components/Dashboard/DashboardCard.dart | 211 +++++++++--------- .../bill_generation_details_provider.dart | 10 +- .../lib/providers/collect_payment.dart | 2 +- .../lib/providers/common_provider.dart | 24 +- .../providers/expenses_details_provider.dart | 71 +++--- .../HouseholdRegister/household_pdf.dart | 62 ++--- .../lib/screeens/dashboard/Dashboard.dart | 5 +- .../lib/screeens/dashboard/dashboard_pdf.dart | 18 +- .../screeens/dashboard/individual_tab.dart | 85 ++++--- .../mgramseva/lib/widgets/Notifications.dart | 5 +- 10 files changed, 250 insertions(+), 243 deletions(-) diff --git a/frontend/mgramseva/lib/components/Dashboard/DashboardCard.dart b/frontend/mgramseva/lib/components/Dashboard/DashboardCard.dart index dabd90e0c..8af7c69cf 100644 --- a/frontend/mgramseva/lib/components/Dashboard/DashboardCard.dart +++ b/frontend/mgramseva/lib/components/Dashboard/DashboardCard.dart @@ -13,7 +13,6 @@ import 'package:mgramseva/utils/Constants/I18KeyConstants.dart'; import 'package:provider/provider.dart'; class DashboardCard extends StatelessWidget { - final Function() onMonthSelection; DashboardCard(this.onMonthSelection); @override @@ -24,125 +23,129 @@ class DashboardCard extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0.0), ), - child: Column( - mainAxisSize: MainAxisSize.min, - children : [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - LabelText(i18.dashboard.DASHBOARD), - InkWell( - onTap: onMonthSelection, - child: Padding( - padding: const EdgeInsets.only(right: 5, bottom: 12), - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - children : [ - Consumer( - builder: (_,dashBoardProvider, child) => Text(DateFormats.getMonthAndYear(dashBoardProvider.selectedMonth, context), - style: Theme.of(context).textTheme.subtitle1?.apply(color: Theme.of(context).primaryColor), - ), - ), - Icon(Icons.arrow_drop_down) - ]), - ), - ) - ]), - _buildRatingView(context, constraints) - ] - )); + child: Column(mainAxisSize: MainAxisSize.min, children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + LabelText(i18.dashboard.DASHBOARD), + Expanded( + child: InkWell( + onTap: onMonthSelection, + child: Container( + alignment: Alignment.centerRight, + padding: const EdgeInsets.only(bottom: 12), + child: Wrap( + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Consumer( + builder: (_, dashBoardProvider, child) => Text( + DateFormats.getMonthAndYear( + dashBoardProvider.selectedMonth, context), + style: Theme.of(context) + .textTheme + .subtitle1 + ?.apply( + color: Theme.of(context).primaryColor), + ), + ), + Icon(Icons.arrow_drop_down) + ]), + ), + ), + ) + ]), + _buildRatingView(context, constraints) + ])); }); } - Widget _buildRatingView(BuildContext context, BoxConstraints constraints) { - return Consumer( - builder: (_,dashBoardProvider, child) - { + return Consumer(builder: (_, dashBoardProvider, child) { var feedBack = dashBoardProvider.userFeedBackInformation; - if(feedBack != null && feedBack.isNotEmpty) { + if (feedBack != null && feedBack.isNotEmpty) { Map feedBackDetails = Map.from(feedBack); feedBackDetails.remove('count'); - var localizationLabel = '${ApplicationLocalizations.of(context).translate(i18.dashboard.USER_GAVE_FEEDBACK)}'; - localizationLabel = localizationLabel.replaceAll('', (feedBack['count'] ?? 0).toString()); - localizationLabel = localizationLabel.replaceAll('', DateFormats.getMonthAndYear(dashBoardProvider.selectedMonth, context)).toString(); + var localizationLabel = + '${ApplicationLocalizations.of(context).translate(i18.dashboard.USER_GAVE_FEEDBACK)}'; + localizationLabel = localizationLabel.replaceAll( + '{n}', (feedBack['count'] ?? 0).toString()); + localizationLabel = localizationLabel + .replaceAll( + '{date}', + DateFormats.getMonthAndYear( + dashBoardProvider.selectedMonth, context)) + .toString(); return Padding( - padding: constraints.maxWidth > 760 ? const EdgeInsets.all(20.0) : const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GridView.count( - crossAxisCount: 3, - childAspectRatio: constraints.maxWidth > 760 ? (1 / .3) : 1.5, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - children: List.generate( - feedBackDetails.keys.length, ( - index) => - GridTile( + padding: constraints.maxWidth > 760 + ? const EdgeInsets.all(20.0) + : const EdgeInsets.all(8.0), + child: + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + GridView.count( + crossAxisCount: 3, + childAspectRatio: constraints.maxWidth > 760 ? (1 / .3) : 1.0, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + children: List.generate( + feedBackDetails.keys.length, + (index) => GridTile( child: Container( decoration: BoxDecoration( - border: index == 0 ? null : Border( - left: - BorderSide(width: 1.0, color: Colors.grey)), + border: index == 0 + ? null + : Border( + left: BorderSide( + width: 1.0, color: Colors.grey)), color: Colors.white, ), - padding: EdgeInsets.all(12), - child: new Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - new Text( - feedBackDetails - .values.toList()[index].toString(), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w700, - ), - ), - Icon(Icons.star, - color: - Theme - .of(context) - .primaryColor), - ], - ), - Expanded( - child: Padding( - padding: const EdgeInsets.only(top: 5.0), - child: Text( - '${ApplicationLocalizations.of(context) - .translate('DASHBOARD_${feedBackDetails.keys - .toList()[index].toString()}')}', - textAlign: TextAlign.center, + // alignment: Alignment.center, + padding: EdgeInsets.symmetric(horizontal: 8), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + new Text( + feedBackDetails.values + .toList()[index] + .toString(), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, ), ), - ) - ]), - )), - ) - ).toList(), - ), - SizedBox(height: 10), - Text("$localizationLabel", - textAlign: TextAlign.start, - style: TextStyle( - fontSize: 12, - color: Color.fromRGBO(11, 12, 12, 1), - fontWeight: FontWeight.w400 - ), - ), - SizedBox(height: 10) - ]), + Icon(Icons.star, + color: + Theme.of(context).primaryColor), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '${ApplicationLocalizations.of(context).translate('DASHBOARD_${feedBackDetails.keys.toList()[index].toString()}')}', + textAlign: TextAlign.center, + ), + ) + ])), + )).toList(), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: Text( + "$localizationLabel", + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 12, + color: Color.fromRGBO(11, 12, 12, 1), + fontWeight: FontWeight.w400), + ), + ), + ]), ); - }else{ + } else { return Container(); } - } - ); + }); } } diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index e34671f00..e971f1546 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -126,9 +126,11 @@ class BillGenerationProvider with ChangeNotifier { billGenerateDetails.om_3Ctrl.text = previousMeterReading.toString()[2]; billGenerateDetails.om_4Ctrl.text = previousMeterReading.toString()[3]; billGenerateDetails.om_5Ctrl.text = previousMeterReading.toString()[4]; - var readDate = DateTime.fromMillisecondsSinceEpoch(meterRes.meterReadings!.first.currentReadingDate) ; + var readDate = DateTime.fromMillisecondsSinceEpoch( + meterRes.meterReadings!.first.currentReadingDate); var reqDate = readDate.add(Duration(days: 1)).toLocal().toString(); - prevReadingDate = DateFormats.dateToTimeStamp(DateFormats.getFilteredDate(reqDate, dateFormat: 'dd/MM/yyyy')); + prevReadingDate = DateFormats.dateToTimeStamp( + DateFormats.getFilteredDate(reqDate, dateFormat: 'dd/MM/yyyy')); } else if (waterconnection.additionalDetails!.meterReading.toString() != '0') { readingExist = false; @@ -283,7 +285,7 @@ class BillGenerationProvider with ChangeNotifier { localizationText = '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.GENERATE_BILL_SUCCESS_SUBTEXT)}'; localizationText = localizationText.replaceFirst( - '', '(+91 - ${billList.bill!.first.mobileNumber})'); + '{number}', '(+91 - ${billList.bill!.first.mobileNumber})'); Navigator.of(context).pushReplacement( new MaterialPageRoute(builder: (BuildContext context) { return CommonSuccess( @@ -389,7 +391,7 @@ class BillGenerationProvider with ChangeNotifier { localizationText = '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.GENERATE_DEMAND_SUCCESS_SUBTEXT)}'; localizationText = localizationText.replaceFirst( - '', + '{billing cycle}', '${ApplicationLocalizations.of(context).translate(selectedBillCycle.toString())}' + ' ${selectedBillYear.financialYear!.toString().substring(2)}'); return localizationText; diff --git a/frontend/mgramseva/lib/providers/collect_payment.dart b/frontend/mgramseva/lib/providers/collect_payment.dart index 2b8795489..69b98d4a8 100644 --- a/frontend/mgramseva/lib/providers/collect_payment.dart +++ b/frontend/mgramseva/lib/providers/collect_payment.dart @@ -416,7 +416,7 @@ class CollectPaymentProvider with ChangeNotifier { localizationText = '${ApplicationLocalizations.of(context).translate(i18.payment.RECEIPT_REFERENCE_WITH_MOBILE_NUMBER)}'; localizationText = localizationText.replaceFirst( - '', '(+91 - ${fetchBill.mobileNumber})'); + '{Number}', '(+91 - ${fetchBill.mobileNumber})'); return localizationText; } diff --git a/frontend/mgramseva/lib/providers/common_provider.dart b/frontend/mgramseva/lib/providers/common_provider.dart index 0b2180f1c..4ec9531e7 100644 --- a/frontend/mgramseva/lib/providers/common_provider.dart +++ b/frontend/mgramseva/lib/providers/common_provider.dart @@ -280,11 +280,11 @@ class CommonProvider with ChangeNotifier { if (mobileNumber == null) { anchorElement = new html.AnchorElement( href: "https://wa.me/send?text=" + - input.toString().replaceFirst('', res!)); + input.toString().replaceFirst('{link}', res!)); } else { anchorElement = new html.AnchorElement( href: "https://wa.me/+91$mobileNumber?text=" + - input.toString().replaceFirst('', res!)); + input.toString().replaceFirst('{link}', res!)); } anchorElement.target = "_blank"; @@ -294,11 +294,11 @@ class CommonProvider with ChangeNotifier { if (mobileNumber == null) { final FlutterShareMe flutterShareMe = FlutterShareMe(); flutterShareMe.shareToWhatsApp( - msg: input.toString().replaceFirst('', res!)); + msg: input.toString().replaceFirst('{link}', res!)); return; } else { link = "https://wa.me/+91$mobileNumber?text=" + - input.toString().replaceFirst('', res!); + input.toString().replaceFirst('{link}', res!); } await canLaunch(link) ? launch(link) @@ -332,11 +332,11 @@ class CommonProvider with ChangeNotifier { String link = (ApplicationLocalizations.of(navigatorKey.currentContext!) .translate(i18.common.SHARE_RECEIPT_LINK) .toString() - .replaceFirst('', payments.paidBy!) - .replaceFirst('', payments.totalAmountPaid.toString()) - .replaceFirst('', + .replaceFirst('{user}', payments.paidBy!) + .replaceFirst('{Amount}', payments.totalAmountPaid.toString()) + .replaceFirst('{new consumer id}', payments.paymentDetails!.first.bill!.consumerCode.toString()) - .replaceFirst('', + .replaceFirst('{Amount}', (payments.totalDue! - payments.totalAmountPaid!).toString())); getStoreFileDetails(res!.filestoreIds!.first, mode, mobileNumber, navigatorKey.currentContext, link); @@ -358,11 +358,11 @@ class CommonProvider with ChangeNotifier { String link = (ApplicationLocalizations.of(navigatorKey.currentContext!) .translate(i18.common.SHARE_BILL_LINK) .toString() - .replaceFirst('', bill.payerName!.toString()) - .replaceFirst('', + .replaceFirst('{user}', bill.payerName!.toString()) + .replaceFirst('{cycle}', '${DateFormats.getMonthWithDay(bill.billDetails?.first?.fromPeriod)} - ${DateFormats.getMonthWithDay(bill.billDetails?.first?.toPeriod)}') - .replaceFirst('', bill.consumerCode!.toString()) - .replaceFirst('', bill.totalAmount.toString())); + .replaceFirst('{new consumer id}', bill.consumerCode!.toString()) + .replaceFirst('{Amount}', bill.totalAmount.toString())); getStoreFileDetails( res!.filestoreIds!.first, mode, diff --git a/frontend/mgramseva/lib/providers/expenses_details_provider.dart b/frontend/mgramseva/lib/providers/expenses_details_provider.dart index 94ea998b1..12a83b8e7 100644 --- a/frontend/mgramseva/lib/providers/expenses_details_provider.dart +++ b/frontend/mgramseva/lib/providers/expenses_details_provider.dart @@ -58,13 +58,12 @@ class ExpensesDetailsProvider with ChangeNotifier { getStoreFileDetails(); } else if (id != null) { var commonProvider = - Provider.of(context, listen: false); + Provider.of(context, listen: false); var query = { 'tenantId': commonProvider.userDetails?.selectedtenant?.code, 'challanNo': id }; - var expenditure = - await ExpensesRepository().searchExpense(query); + var expenditure = await ExpensesRepository().searchExpense(query); if (expenditure != null && expenditure.isNotEmpty) { expenditureDetails = expenditure.first; getStoreFileDetails(); @@ -110,34 +109,36 @@ class ExpensesDetailsProvider with ChangeNotifier { var res = await ExpensesRepository().addExpenses(body, isUpdate); Navigator.pop(context); var challanDetails = res['challans']?[0]; - String localizationText = getLocalizedData(isUpdate, context, challanDetails); - + String localizationText = + getLocalizedData(isUpdate, context, challanDetails); navigatorKey.currentState ?.push(MaterialPageRoute(builder: (BuildContext context) { return isUpdate - - ? CommonSuccess(SuccessHandler( - i18.expense.MODIFIED_EXPENDITURE_SUCCESSFULLY, - localizationText, - i18.common.BACK_HOME, - isUpdate ? Routes.EXPENSE_UPDATE : Routes.EXPENSES_ADD, subtitleFun: () => getLocalizedData(isUpdate, context, challanDetails)), backButton: true, - ) - + ? CommonSuccess( + SuccessHandler( + i18.expense.MODIFIED_EXPENDITURE_SUCCESSFULLY, + localizationText, + i18.common.BACK_HOME, + isUpdate ? Routes.EXPENSE_UPDATE : Routes.EXPENSES_ADD, + subtitleFun: () => + getLocalizedData(isUpdate, context, challanDetails)), + backButton: true, + ) : CommonSuccess( SuccessHandler( - i18.expense.CORE_EXPENSE_EXPENDITURE_SUCESS, - localizationText, - i18.expense.ADD_NEW_EXPENSE, - isUpdate ? Routes.EXPENSE_UPDATE : Routes.EXPENSES_ADD, - subHeader: - '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.BILL_ID_NO)}', - subHeaderText: '${challanDetails['challanNo'] ?? ''}', - subtitleFun: () => getLocalizedData(isUpdate, context, challanDetails) - ),backButton: true, + i18.expense.CORE_EXPENSE_EXPENDITURE_SUCESS, + localizationText, + i18.expense.ADD_NEW_EXPENSE, + isUpdate ? Routes.EXPENSE_UPDATE : Routes.EXPENSES_ADD, + subHeader: + '${ApplicationLocalizations.of(context).translate(i18.demandGenerate.BILL_ID_NO)}', + subHeaderText: '${challanDetails['challanNo'] ?? ''}', + subtitleFun: () => + getLocalizedData(isUpdate, context, challanDetails)), + backButton: true, callBack: onClickOfBackButton, - ); - + ); })); } on CustomException catch (e, s) { Navigator.pop(context); @@ -152,23 +153,23 @@ class ExpensesDetailsProvider with ChangeNotifier { } } - - String getLocalizedData(bool isUpdate, BuildContext context, Map challanDetails){ + String getLocalizedData( + bool isUpdate, BuildContext context, Map challanDetails) { late String localizationText; if (isUpdate) { localizationText = - '${ApplicationLocalizations.of(context).translate(i18.expense.EXPENDITURE_BILL_ID)}'; + '${ApplicationLocalizations.of(context).translate(i18.expense.EXPENDITURE_BILL_ID)}'; localizationText = localizationText.replaceFirst( - '< Bill ID>', '${challanDetails['challanNo'] ?? ''}'); + '{Bill ID}', '${challanDetails['challanNo'] ?? ''}'); } else { localizationText = - '${ApplicationLocalizations.of(context).translate(i18.expense.EXPENDITURE_SUCESS)}'; - localizationText = localizationText.replaceFirst( - '', expenditureDetails.vendorNameCtrl.text.trim()); + '${ApplicationLocalizations.of(context).translate(i18.expense.EXPENDITURE_SUCESS)}'; localizationText = localizationText.replaceFirst( - '', expenditureDetails.expensesAmount?.first.amount ?? ''); + '{Vendor}', expenditureDetails.vendorNameCtrl.text.trim()); localizationText = localizationText.replaceFirst( - '', '${ApplicationLocalizations.of(context).translate(expenditureDetails.expenseType ?? '')}'); + '{Amount}', expenditureDetails.expensesAmount?.first.amount ?? ''); + localizationText = localizationText.replaceFirst('{type of expense}', + '${ApplicationLocalizations.of(context).translate(expenditureDetails.expenseType ?? '')}'); } return localizationText; } @@ -311,8 +312,8 @@ class ExpensesDetailsProvider with ChangeNotifier { return status; } - Future searchExpense( - Map query, String Function() criteria, BuildContext context) async { + Future searchExpense(Map query, + String Function() criteria, BuildContext context) async { try { Loaders.showLoadingDialog(context); diff --git a/frontend/mgramseva/lib/screeens/HouseholdRegister/household_pdf.dart b/frontend/mgramseva/lib/screeens/HouseholdRegister/household_pdf.dart index f75e94f75..2b0dc323b 100644 --- a/frontend/mgramseva/lib/screeens/HouseholdRegister/household_pdf.dart +++ b/frontend/mgramseva/lib/screeens/HouseholdRegister/household_pdf.dart @@ -1,25 +1,17 @@ -import 'dart:io'; - import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:mgramseva/providers/common_provider.dart'; -import 'package:mgramseva/providers/dashboard_provider.dart'; import 'package:mgramseva/providers/household_register_provider.dart'; -import 'package:mgramseva/providers/language.dart'; import 'package:mgramseva/utils/Constants/I18KeyConstants.dart'; import 'package:mgramseva/utils/Locilization/application_localizations.dart'; import 'package:mgramseva/utils/constants.dart'; import 'package:mgramseva/utils/date_formats.dart'; import 'package:mgramseva/utils/global_variables.dart'; -import 'package:mgramseva/utils/models.dart'; import 'package:mgramseva/utils/pdf.dart'; -import 'package:path_provider/path_provider.dart'; import 'package:pdf/pdf.dart'; import 'package:provider/provider.dart'; import 'package:pdf/widgets.dart' as pw; -import 'package:universal_html/html.dart' as html; class HouseholdPdfCreator { final List headers; @@ -43,14 +35,19 @@ class HouseholdPdfCreator { final date = DateFormats.getFilteredDate( DateTime.now().toLocal().toString(), dateFormat: "dd/MM/yyyy"); + String recordsCount = + '${ApplicationLocalizations.of(buildContext).translate(i18.householdRegister.NO_OF_RECORDS)}'; + recordsCount = recordsCount.replaceAll('{n}', '${tableData.length}'); var localizedText = ApplicationLocalizations.of(navigatorKey.currentContext!) .translate(i18.householdRegister.PDF_SUB_TEXT_BELOW_LIST); localizedText = localizedText.replaceFirst( - '', householdProvider.selectedTab); - localizedText = localizedText.replaceFirst( - '', householdProvider.searchController.text.toString()); - localizedText = localizedText.replaceFirst('', date); + '{selectedTab}', + ApplicationLocalizations.of(navigatorKey.currentContext!) + .translate(householdProvider.selectedTab)); + localizedText = localizedText.replaceFirst('{search}', + '${householdProvider.searchController.text.trim().isEmpty ? '-' : householdProvider.searchController.text.trim()}'); + localizedText = localizedText.replaceFirst('{date}', date); var icons = pw.Font.ttf(await rootBundle.load('assets/icons/fonts/PdfIcons.ttf')); @@ -88,7 +85,7 @@ class HouseholdPdfCreator { style: pw.TextStyle(font: ttf, fontSize: 12)), pw.SizedBox(height: 20), pw.Text( - '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.householdRegister.CONSUMER_RECORDS)} (${householdProvider.selectedTab})', + '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.householdRegister.CONSUMER_RECORDS)} (${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(householdProvider.selectedTab)})', style: pw.TextStyle( font: ttf, fontSize: 18, @@ -102,41 +99,32 @@ class HouseholdPdfCreator { fontSize: 10, color: PdfColor.fromHex('#474747'), ), - ) + ), + pw.SizedBox(height: 10), + pw.Container( + alignment: pw.Alignment.centerRight, + padding: pw.EdgeInsets.only(bottom: 10), + child: pw.Text( + recordsCount, + style: pw.TextStyle( + font: ttf, + fontWeight: pw.FontWeight.bold, + fontSize: 10), + )), ]), ), pw.SizedBox(height: 20), _buildTable(ttf), - PdfUtils.pdfFooter(digitLogo) ]; })); var whatsappText = '${ApplicationLocalizations.of(buildContext).translate(i18.householdRegister.WHATSAPP_TEXT_HOUSEHOLD)}'; - whatsappText = whatsappText.replaceAll('', date); + whatsappText = whatsappText.replaceAll('{Date}', date); Provider.of(buildContext, listen: false).sharePdfOnWhatsApp( buildContext, pdf, 'HouseholdRegister', whatsappText, isDownload: isDownload); - - /* if (kIsWeb) { - final blob = html.Blob([await pdf.save()]); - final url = html.Url.createObjectUrlFromBlob(blob); - final anchor = html.document.createElement('a') as html.AnchorElement - ..href = url - ..style.display = 'none' - ..download = 'Household.pdf'; - html.document.body?.children.add(anchor); - anchor.click(); - html.document.body?.children.remove(anchor); - html.Url.revokeObjectUrl(url); - } else { - final Directory directory = await getApplicationDocumentsDirectory(); - final file = File('${directory.path}/Household.pdf'); - await file.writeAsBytes(await pdf.save()); - // Navigator.pushReplacement(buildContext, - // MaterialPageRoute(builder: (_) => PdfPreview(path: file.path))); - }*/ } pw.Table _buildTable(pw.Font ttf) { @@ -147,8 +135,6 @@ class HouseholdPdfCreator { cellStyle: pw.TextStyle(font: ttf, fontSize: 12), cellAlignment: pw.Alignment.center, data: tableData, - oddRowDecoration: pw.BoxDecoration(color: PdfColor.fromHex('#EEEEEE')) - //headerDecoration: pw.BoxDecoration(color: PdfColor.fromRYB(0.98, 0.60, 0.01)) - ); + oddRowDecoration: pw.BoxDecoration(color: PdfColor.fromHex('#EEEEEE'))); } } diff --git a/frontend/mgramseva/lib/screeens/dashboard/Dashboard.dart b/frontend/mgramseva/lib/screeens/dashboard/Dashboard.dart index 15d556adb..8786f427d 100644 --- a/frontend/mgramseva/lib/screeens/dashboard/Dashboard.dart +++ b/frontend/mgramseva/lib/screeens/dashboard/Dashboard.dart @@ -252,7 +252,8 @@ class _Dashboard extends State with SingleTickerProviderStateMixin { Widget get _buildShare => TextButton.icon( onPressed: takeScreenShotOfDashboard, icon: Image.asset('assets/png/whats_app.png'), - label: Text(i18.common.SHARE)); + label: Text( + ApplicationLocalizations.of(context).translate(i18.common.SHARE))); void onTapOfMonthPicker() { var dashBoardProvider = @@ -327,7 +328,7 @@ class _Dashboard extends State with SingleTickerProviderStateMixin { '${ApplicationLocalizations.of(context).translate(i18.dashboard.ANNUAL_SHARE_MSG_WEB)}'; localizedText = localizedText.replaceFirst('{year-year}', '${DateFormats.getMonthAndYear(dashBoardProvider.selectedMonth, context)}'); - localizedText = localizedText.replaceFirst('{link}', ''); + localizedText = localizedText.replaceFirst('{link}', '{link}'); commonProvider.shareonwatsapp( response.first, null, localizedText); } diff --git a/frontend/mgramseva/lib/screeens/dashboard/dashboard_pdf.dart b/frontend/mgramseva/lib/screeens/dashboard/dashboard_pdf.dart index c7473b43e..9c73bb483 100644 --- a/frontend/mgramseva/lib/screeens/dashboard/dashboard_pdf.dart +++ b/frontend/mgramseva/lib/screeens/dashboard/dashboard_pdf.dart @@ -44,26 +44,26 @@ class DashboardPdfCreator { String billDescription = ''; String recordsCount = '${ApplicationLocalizations.of(buildContext).translate(i18.dashboard.NUMBER_OF_RECORDS)}'; - recordsCount = recordsCount.replaceAll('', '${tableData.length}'); + recordsCount = recordsCount.replaceAll('{n}', '${tableData.length}'); if (dashBoardProvider.selectedDashboardType == DashBoardType.Expenditure) { billDescription = '${ApplicationLocalizations.of(buildContext).translate(i18.dashboard.EXPENDITURE_DESC)}'; - billDescription = billDescription.replaceAll('', + billDescription = billDescription.replaceAll('{Pending Or Paid}', '${ApplicationLocalizations.of(buildContext).translate(dashBoardProvider.selectedTab)}'); - billDescription = billDescription.replaceAll('', + billDescription = billDescription.replaceAll('{text}', '${dashBoardProvider.searchController.text.trim().isEmpty ? '-' : dashBoardProvider.searchController.text.trim()}'); billDescription = billDescription.replaceAll( - '