From a766c2522ee8ccb6f3a50caf6093f03636949df6 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Thu, 21 Oct 2021 12:21:42 +0300 Subject: [PATCH] Child Vaccine 1.0 --- lib/config/config.dart | 4 +- .../all_habib_medical_service_page.dart | 3 +- .../ChildVaccines/new/child_vaccine_page.dart | 304 ++++++++++++++++++ lib/pages/landing/widgets/services_view.dart | 3 +- lib/theme/colors.dart | 3 + 5 files changed, 313 insertions(+), 4 deletions(-) create mode 100644 lib/pages/ChildVaccines/new/child_vaccine_page.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 75a904ea..a6565ecf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index ce3bde14..8f130d93 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; @@ -277,7 +278,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(page: ChildVaccinesPage()), + FadePage(page: ChildVaccinePage()), ), imageLocation: 'assets/images/new-design/children_vaccines_icon.png', title: TranslationBase.of(context).childVaccine, diff --git a/lib/pages/ChildVaccines/new/child_vaccine_page.dart b/lib/pages/ChildVaccines/new/child_vaccine_page.dart new file mode 100644 index 00000000..2563fa63 --- /dev/null +++ b/lib/pages/ChildVaccines/new/child_vaccine_page.dart @@ -0,0 +1,304 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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/uitl/utils_new.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:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import '../add_newchild_page.dart'; +import '../vaccinationtable_page.dart'; + +class ChildVaccinePage extends StatefulWidget { + @override + _ChildPageState createState() => _ChildPageState(); +} + +class _ChildPageState extends State with SingleTickerProviderStateMixin { + DeleteBaby deleteBaby = DeleteBaby(); + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double height = (size.height - kToolbarHeight - 60); + final double itemWidth = size.width / 2; + final double itemHeight = height / 2 + 40; + + var checkedValue = true; + return BaseView( + onModelReady: (model) => model.getNewUserOrders(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).vaccination, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + body: Column( + children: [ + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(model.babyInformationModelList[index]), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(left: 0, right: 0, bottom: 20), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(12)), + color: Colors.white, + gradient: LinearGradient( + colors: model.babyInformationModelList[index].gender == 1 + ? [ + Color(0xFFFDA4B0), + Color(0xFFFBC8CC), + ] + : [ + Color(0xFF6EA8FF), + Color(0xFF7AB8FD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.all(12), + //double.infinity, + child: Column( + children: [ + Texts(model.babyInformationModelList[index].babyName.trim()), + Row(children: [ + IconButton( + icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(model.babyInformationModelList[index].genderDescription), + IconButton( + icon: Icon( + Icons.remove_red_eye, + color: Colors.red, + ), + tooltip: '', + onPressed: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(model.babyInformationModelList[index]), + ), + ); + }, + ) + ]), + Row(children: [ + Texts(TranslationBase.of(context).dob), + ]), + Row(children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/calender-secondary.png'), + tooltip: '', + onPressed: () { + setState(() {}); + }, + ), + Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)), + ]), + Row(children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: () async { + //===================== + await model.deleteBabyOrders(newChild: deleteBaby); + + deleteBaby.babyID = model.babyInformationModelList[index].babyID; + + await model.deleteBabyOrders(newChild: deleteBaby); + if (model.isDeleted) { + AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); + Navigator.pop(context, model.isDeleted); + } else { + //TODO handling error + } + }, + ), + Texts(TranslationBase.of(context).deleteView), + ]), + SizedBox( + height: 12, + ), + ], + ), + ), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return mHeight(12); + }, + itemCount: model.babyInformationModelList.length, + ), + ), + // Container( + // height: height * 0.85, + // child: SingleChildScrollView( + // child: Container( + // margin: EdgeInsets.only(left: 8, right: 8, top: 16), + // child: GridView.count( + // crossAxisCount: 2, + // childAspectRatio: (itemWidth / (itemHeight + 0)), + // crossAxisSpacing: 10, + // mainAxisSpacing: 10, + // controller: ScrollController(keepScrollOffset: true), + // shrinkWrap: true, + // padding: const EdgeInsets.all(4.0), + // children: [ + // ...List.generate( + // model.babyInformationModelList.length, + // (index) => InkWell( + // onTap: () { + // Navigator.push( + // context, + // FadePage( + // page: VaccinationTablePage(model.babyInformationModelList[index]), + // ), + // ); + // }, + // child: Container( + // margin: EdgeInsets.only(left: 0, right: 0, bottom: 20), + // 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), + // //double.infinity, + // child: Column( + // children: [ + // Row(children: [ + // Texts(TranslationBase.of(context).childName), + // ]), + // Row(children: [ + // Texts(model.babyInformationModelList[index].babyName.trim()), + // ]), + // Row(children: [ + // IconButton( + // icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'), + // tooltip: '', + // onPressed: () { + // setState(() { + // // _volume += 10; + // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // }); + // }, + // ), + // Texts(model.babyInformationModelList[index].genderDescription), + // IconButton( + // icon: Icon( + // Icons.remove_red_eye, + // color: Colors.red, + // ), + // tooltip: '', + // onPressed: () { + // Navigator.push( + // context, + // FadePage( + // page: VaccinationTablePage(model.babyInformationModelList[index]), + // ), + // ); + // }, + // ) + // ]), + // Row(children: [ + // Texts(TranslationBase.of(context).dob), + // ]), + // Row(children: [ + // IconButton( + // icon: new Image.asset('assets/images/new-design/calender-secondary.png'), + // tooltip: '', + // onPressed: () { + // setState(() {}); + // }, + // ), + // Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)), + // ]), + // Row(children: [ + // IconButton( + // icon: new Image.asset('assets/images/new-design/garbage.png'), + // tooltip: '', + // onPressed: () async { + // //===================== + // await model.deleteBabyOrders(newChild: deleteBaby); + // + // deleteBaby.babyID = model.babyInformationModelList[index].babyID; + // + // await model.deleteBabyOrders(newChild: deleteBaby); + // if (model.isDeleted) { + // AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); + // Navigator.pop(context, model.isDeleted); + // } else { + // //TODO handling error + // } + // }, + // ), + // Texts(TranslationBase.of(context).deleteView), + // ]), + // SizedBox( + // height: 12, + // ), + // ], + // ), + // ), + // ), + // ) + // ], + // ))), + // ), + ], + ), + bottomSheet: Container( + height: height * 0.15, + width: double.infinity, + padding: EdgeInsets.all(16), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: TranslationBase.of(context).addNewChild, + // + onTap: () { + Navigator.push( + context, + FadePage( + page: AddNewChildPage(), + ), + ).then((value) { + if (value) model.getNewUserOrders(); + }); + }, + ), + ), + )); + } +} diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index f6be4937..2eae79d3 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; @@ -102,7 +103,7 @@ class ServicesView extends StatelessWidget { } else if (index == 14) { Navigator.push( context, - FadePage(page: ChildVaccinesPage()), + FadePage(page: ChildVaccinePage()), ); } else if (index == 15) { Navigator.pop(context); diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 2987e6216..6640b442 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -20,4 +20,7 @@ class CustomColors { static const Color appBackgroudGrey2Color = Color(0xFFF8F8F8); static const Color green = Color(0xFF359846); static const Color orange = Color(0xFFCC9B14); + + static const Color femaleColor = Color(0xFF359846); + static const Color maleColor = Color(0xFFCC9B14); }