From 49974f81db2ccaf8a32297ac8a66458711b2ad12 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Sun, 29 Nov 2020 12:29:09 +0200 Subject: [PATCH] add translations to child Vaccination --- lib/config/localized_values.dart | 60 ++++++ .../ChildVaccines/ChidDetailsWidget.dart | 15 +- lib/pages/ChildVaccines/child_page.dart | 9 +- .../ChildVaccines/child_vaccines_page.dart | 18 +- .../dialogs/SelectGenderDialog.dart | 1 + .../ChildVaccines/vaccinationtable_page.dart | 191 +++++++++++------- lib/uitl/translations_delegate_base.dart | 14 ++ 7 files changed, 216 insertions(+), 92 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2f746c51..978d83af 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1069,4 +1069,64 @@ const Map localizedValues = { "ar": "أرسل التقرير" }, + "vaccination": { + "en": "Vaccination", + "ar": "جدول التطعيمات" + }, + "welcomeBack": { + "en": "Welcome back", + "ar": "مرحبا مرة أخرى" + }, + "instructions": { + "en": "Please ensure that the email address is up-to-date and process to view the schedule", + "ar": "يرجى التأكد من صحة عنوان البريد الالكتروني و المتابعة لعرض الجدول " + }, + "update-email": { + "en": "Update Email", + "ar": "تحديث البريد الالكتروني" + }, + + "updated-email": { + "en": "Updated email successfully", + "ar": "تم تحديث البريد الالكتروني" + }, + + "view-list-children": { + "en": "View List of Children", + "ar": "عرض قائمة الأطفال" + }, + + "add-child": { + "en": "Add New Child", + "ar": "اضافة طفل" + }, + "child-name": { + "en": "Child Name", + "ar": "اسم الطفل" + }, + "childDob": { + "en": "Birth Date", + "ar": "تاريخ الولادة" + }, + "delete": { + "en": "Delete", + "ar": "حذف" + }, + "deleted-child": { + "en": "The request was successful. The children have removed from the vaccination schedule subscription service.", + "ar": "تم حذف الطفل بنجاح" + }, + "visit": { + "en": "Visit", + "ar": "زيارة" + }, + "description-vaccination": { + "en": "Description", + "ar": "وصف" + }, + "due-date": { + "en": "Due date", + "ar": "تاريخ الاستحقاق" + }, + }; diff --git a/lib/pages/ChildVaccines/ChidDetailsWidget.dart b/lib/pages/ChildVaccines/ChidDetailsWidget.dart index 7a7d52e2..bce5d54e 100644 --- a/lib/pages/ChildVaccines/ChidDetailsWidget.dart +++ b/lib/pages/ChildVaccines/ChidDetailsWidget.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccin import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -32,7 +33,7 @@ class ChildDetailsWidget extends StatelessWidget { child: Column( children: [ Row(children: [ - Texts("CHILD NAME"), + Texts(TranslationBase.of(context).childName), ]), Row(children: [ Texts(babyInfo.babyName.trim()), @@ -44,10 +45,6 @@ class ChildDetailsWidget extends StatelessWidget { : 'assets/images/new-design/female.png'), tooltip: '', onPressed: () { - // setState(() { - // // _volume += 10; - // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); - // }); }, ), Texts(babyInfo.genderDescription), @@ -61,14 +58,14 @@ class ChildDetailsWidget extends StatelessWidget { Navigator.push( context, FadePage( - page: VaccinationTablePage(), + page: VaccinationTablePage(babyInfo: babyInfo,), ), ); }, ) ]), Row(children: [ - Texts("Birthday"), + Texts(TranslationBase.of(context).childDob), ]), Row( children: [ @@ -92,14 +89,14 @@ class ChildDetailsWidget extends StatelessWidget { await model.deleteBabyOrders(newChild: deleteBaby); if (model.isDeleted) { - AppToast.showSuccessToast(message: "Record Deleted"); + AppToast.showSuccessToast(message: TranslationBase.of(context).deletedChild); Navigator.pop(context, model.isDeleted); } else { //TODO handling error } }, ), - Texts("Delete"), + Texts(TranslationBase.of(context).delete), ]), SizedBox( height: 12, diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart index c2999ca2..7493a492 100644 --- a/lib/pages/ChildVaccines/child_page.dart +++ b/lib/pages/ChildVaccines/child_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart' import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -20,7 +21,7 @@ class ChildPage extends StatefulWidget { @override _ChildPageState createState() => _ChildPageState(); } - +//TODO class _ChildPageState extends State with SingleTickerProviderStateMixin { DeleteBaby deleteBaby = DeleteBaby(); @@ -32,7 +33,7 @@ class _ChildPageState extends State onModelReady: (model) => model.getNewUserOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: " Vaccination", + appBarTitle: TranslationBase.of(context).vaccination, baseViewModel: model, body: SingleChildScrollView( child: Container( @@ -46,7 +47,7 @@ class _ChildPageState extends State gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, childAspectRatio: MediaQuery.of(context).size.width / - (MediaQuery.of(context).size.height / 1.25), + (MediaQuery.of(context).size.height / 1.45), ), itemCount: model.babyInformationModelList.length, itemBuilder: (BuildContext context, int index) { @@ -77,7 +78,7 @@ class _ChildPageState extends State 74, 1, ), - label: "ADD NEW CHILD ", + label: TranslationBase.of(context).addChild, // onTap: () { Navigator.push( diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart index 14eae875..4dd4c7f5 100644 --- a/lib/pages/ChildVaccines/child_vaccines_page.dart +++ b/lib/pages/ChildVaccines/child_vaccines_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_mod import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; @@ -30,8 +31,7 @@ class _ChildVaccinesPageState extends State builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, - appBarTitle: " Vaccination", - //TranslationBase.of(context).advancePayment, + appBarTitle: TranslationBase.of(context).vaccination, body: SingleChildScrollView( physics: ScrollPhysics(), child: Column( @@ -41,12 +41,11 @@ class _ChildVaccinesPageState extends State SizedBox( height: 20, ), - Padding( padding: const EdgeInsets.all(10.0), child: Container( child: Texts( - "Welcome back", + TranslationBase.of(context).welcomeBackV, fontSize: 20, ), ), @@ -63,12 +62,11 @@ class _ChildVaccinesPageState extends State padding: const EdgeInsets.all(10.0), child: Container( child: Texts( - "Please ensure that the email address is up-to-date and process to view the schedule", + TranslationBase.of(context).instructions, fontSize: 20, ), ), ), - Divider( color: Colors.black, indent: 10, @@ -115,11 +113,12 @@ class _ChildVaccinesPageState extends State 74, 1, ), - label: "UPDATE EMAIL", + label: TranslationBase.of(context).updateEmail, // onTap: () { model.user.emailAddress = addEmail.toString(); - AppToast.showSuccessToast(message: "Email updated"); + AppToast.showSuccessToast( + message: TranslationBase.of(context).updatedEmail); // bloodDetails.city=_selectedHospital.toString(); // bloodDetails. @@ -138,7 +137,7 @@ class _ChildVaccinesPageState extends State 74, 1, ), - label: " VIEW LIST OF CHILDREN", + label: TranslationBase.of(context).viewListChildren, // onTap: () => Navigator.push( context, @@ -148,7 +147,6 @@ class _ChildVaccinesPageState extends State ), ), ), - SizedBox( height: MediaQuery.of(context).size.height * 0.15, ) diff --git a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart index 259bbdb7..33c11020 100644 --- a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart +++ b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart @@ -14,6 +14,7 @@ class SelectGenderDialog extends StatefulWidget { } class _SelectGenderDialogState extends State { + @override Widget build(BuildContext context) { return SimpleDialog( diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart index c160acfb..4654c75a 100644 --- a/lib/pages/ChildVaccines/vaccinationtable_page.dart +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -1,101 +1,154 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; - +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'dialogs/SelectGenderDialog.dart'; class VaccinationTablePage extends StatelessWidget { + final List_BabyInformationModel babyInfo; + + const VaccinationTablePage({Key key, this.babyInfo}) : super(key: key); @override Widget build(BuildContext context) { var checkedValue; return BaseView( - onModelReady: (model) => model.getCreateVaccinationTable(),//getUserTermsAndConditions(), + onModelReady: (model) => model.getCreateVaccinationTable(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, - appBarTitle: "Vaccination", + appBarTitle: TranslationBase.of(context).vaccination, body: SingleChildScrollView( - child:Container( - margin: EdgeInsets.only(left: 15,right: 15,top: 70), + child: Container( + margin: EdgeInsets.only(left: 15, right: 15, top: 10), child: Column( - children: [//babyInformationModelList.length - ...List.generate(model.creteVaccinationTableModelList.length, (index) => - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, - + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Column( + children: [ + Texts(TranslationBase.of(context).childName), + Texts(babyInfo.babyName??'',fontWeight: FontWeight.w600,), + ], + ), + ), + Expanded( + child: Column(children: [ + + Texts(TranslationBase.of(context).childDob), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(FontAwesomeIcons.calendarCheck,color: Colors.red,), + SizedBox(width: 15,), + Texts(DateUtil.yearMonthDay(babyInfo.dOB)??''), + ], + ), + ], + ), + ), + ], + ), + SizedBox(height: 15,), + Divider(), + Column( + children: [ + Row( + children: [ + Texts(TranslationBase.of(context).visit), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts(TranslationBase.of(context).descriptionVaccination), + ], + ), ), - padding: EdgeInsets.all(12), - width: double.infinity, - child: Column( + Texts(TranslationBase.of(context).dueDate), + ], + ), + ], + ), + ...List.generate( + model.creteVaccinationTableModelList.length, + (index) => Container( + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // border: Border.all(color: Colors.white, width: 0.5), + // borderRadius: BorderRadius.all(Radius.circular(5)), + // // color: Colors.white, + // ), + padding: EdgeInsets.all(12), + width: double.infinity, + child: Column( + children: [ + Row( children: [ - Row(children: [ - Text(model.creteVaccinationTableModelList[index].visit), - SizedBox(width: 10,), - - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Html( - // data:"
BCG
HEPATITIS B
"//model.creteVaccinationTableModelList[index].vaccinesDescription - data:model.creteVaccinationTableModelList[index].vaccinesDescription, - - ), - ],), - ), - Text(model.creteVaccinationTableModelList[index].givenAt), - - - ],), - Divider(color:Colors.black ,), - + Texts(model + .creteVaccinationTableModelList[index].visit), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Html( + data: model.creteVaccinationTableModelList[index].vaccinesDescription, + ), + ], + ), + ), + Texts(model.creteVaccinationTableModelList[index].givenAt), ], - ) - - - ) - + ), + Divider( + color: Colors.white,height: 3,thickness: 1.0, + ), + ], + ), + ), ) ], ), - + ), ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), - label: "Send Email ", - // - onTap: () { - //SelectGenderDialog(); -//=============== - showDialog( - context: context, - child: SelectGenderDialog( - ), - ); - //========= - } - - + bottomSheet: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO(63, 72, 74, 1,), + label: TranslationBase.of(context).sendEmail, + onTap: () { + showDialog( + context: context, + child: SelectGenderDialog(), + ); + }, + ), ), ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b1d2667d..b1162f5b 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -875,6 +875,20 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get report => localizedValues['report'][locale.languageCode]; String get openRad => localizedValues['open-rad'][locale.languageCode]; String get sendCopyRad => localizedValues['send-copy'][locale.languageCode]; + String get vaccination => localizedValues['vaccination'][locale.languageCode]; + String get welcomeBackV => localizedValues['welcomeBack'][locale.languageCode]; + String get instructions => localizedValues['instructions'][locale.languageCode]; + String get updateEmail => localizedValues['update-email'][locale.languageCode]; + String get updatedEmail => localizedValues['updated-email'][locale.languageCode]; + String get viewListChildren => localizedValues['view-list-children'][locale.languageCode]; + String get addChild => localizedValues['add-child'][locale.languageCode]; + String get childName => localizedValues['child-name'][locale.languageCode]; + String get childDob => localizedValues['childDob'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; + String get deletedChild => localizedValues['deleted-child'][locale.languageCode]; + String get visit => localizedValues['visit'][locale.languageCode]; + String get descriptionVaccination => localizedValues['description-vaccination'][locale.languageCode]; + String get dueDate => localizedValues['due-date'][locale.languageCode]; }