From 4db432b3517538f31eb28a41ca98f3644de21bd3 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 11 Aug 2021 16:32:30 +0300 Subject: [PATCH] lab results working(cont.) & improvements --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 5 +- .../viewModels/medical/labs_view_model.dart | 2 +- lib/pages/landing/landing_page.dart | 156 +++++----- lib/pages/login/confirm-login.dart | 17 +- lib/pages/login/welcome.dart | 132 +++++---- lib/pages/medical/labs/labs_home_page.dart | 185 +++++++----- .../medical/medical_profile_page_new.dart | 2 + lib/pages/medical/my_admissions_page.dart | 6 +- .../medical/patient_sick_leave_page.dart | 9 +- .../prescriptions/prescriptions_page.dart | 2 +- .../radiology/radiology_home_page.dart | 2 +- lib/uitl/date_uitl.dart | 8 + lib/uitl/translations_delegate_base.dart | 4 + lib/widgets/avatar/large_avatar.dart | 26 +- lib/widgets/buttons/defaultButton.dart | 38 +-- .../data_display/medical/doctor_card.dart | 275 ++++++++---------- .../others/app_expandable_notifier.dart | 130 ++++----- lib/widgets/others/app_scaffold_widget.dart | 2 +- 19 files changed, 502 insertions(+), 503 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index f8bca863..1a309e96 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ 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/config/localized_values.dart b/lib/config/localized_values.dart index c3035621..fdd91eaf 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -39,7 +39,9 @@ const Map localizedValues = { 'bookAppo': {'en': 'Book Appointment', 'ar': 'حجز موعد'}, 'searchBy': {'en': 'Search By:', 'ar': 'البحث عن طريق:'}, 'clinic': {'en': 'Clinic', 'ar': 'العيادة'}, + 'by-clinic': {'en': 'By Clinic', 'ar': 'العيادة'}, 'hospital': {'en': 'Hospital', 'ar': 'المستشفى'}, + 'by-hospital': {'en': 'By Hospital', 'ar': 'المستشفى'}, 'name': {'en': 'Name', 'ar': 'الإسم'}, 'doctor': {'en': 'Doctor', 'ar': 'الطبيب'}, 'clinicName': {'en': 'Clinic Name', 'ar': 'اسم العيادة'}, @@ -135,6 +137,7 @@ const Map localizedValues = { "verify-through": {"en": "Verify Through", "ar": " تحقق من خلال"}, "last-login": {"en": "LAST LOGIN AT:", "ar": "آخر تسجيل دخول"}, "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "نوع التحقق:"}, + "please-verify": {"en": "Please Verify", "ar": "ارجوك تحقق:"}, "verify-fingerprint": { "en": "To activate the fingerprint login service, please verify data by using one of the following options.", "ar": "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" @@ -823,7 +826,7 @@ const Map localizedValues = { "send-copy": {"en": "Email the Report", "ar": "أرسل التقرير"}, "appoSurvey": {"en": "Survey", "ar": "إستبيان"}, "appoSurveySubtitle": {"en": "Survey", "ar": "إستبيان"}, - "labResults": {"en": "Lab Result", "ar": "نتيجة المختبر"}, + "labResults": {"en": "Lab Results", "ar": "نتيجة المختبر"}, "doctorRating": {"en": "Doctor Rating", "ar": "تقييم الطبيب"}, "good": {"en": "Good", "ar": "جيد"}, "v-good": {"en": "Very Good", "ar": "جيد جدا"}, diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index f75abe88..956c1982 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -66,7 +66,7 @@ class LabsViewModel extends BaseViewModel { } } - setFilterType(FilterType filterType) { + setFilterType(FilterType filterType) { this.filterType = filterType; notifyListeners(); } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index e90c36d2..f742b227 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -497,86 +497,88 @@ class _LandingPageState extends State with WidgetsBindingObserver { projectViewModel = Provider.of(context); return Scaffold( - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), - ), - title: Text( - getText(currentTab).toUpperCase(), - style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), - // bold: true, - // color: Colors.white, - ), - leading: Builder( - builder: (BuildContext context) { - return new Stack( - children: [ - currentTab == 0 - ? IconButton( - icon: Icon(Icons.menu), - color: Theme.of(context).textTheme.headline1.color, - onPressed: () => Scaffold.of(context).openDrawer(), - ) - : IconButton( - icon: Icon(Icons.arrow_back), - color: Theme.of(context).textTheme.headline1.color, - onPressed: () { - setState(() { - currentTab = 0; - }); - - pageController.jumpToPage(0); - }, - ), - notificationCount != '' - ? new Positioned( - right: projectViewModel.isArabic ? 35 : 0, - top: 5, - child: new Container( - padding: EdgeInsets.all(4), - decoration: new BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(20), - ), - constraints: BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: new Text( - notificationCount, - style: new TextStyle( - color: Colors.white, - fontSize: projectViewModel.isArabic ? 8 : 9, + appBar: currentTab == 1 + ? null + : AppBar( + elevation: 0, + textTheme: TextTheme( + headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), + ), + title: Text( + getText(currentTab).toUpperCase(), + style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), + // bold: true, + // color: Colors.white, + ), + leading: Builder( + builder: (BuildContext context) { + return new Stack( + children: [ + currentTab == 0 + ? IconButton( + icon: Icon(Icons.menu), + color: Theme.of(context).textTheme.headline1.color, + onPressed: () => Scaffold.of(context).openDrawer(), + ) + : IconButton( + icon: Icon(Icons.arrow_back), + color: Theme.of(context).textTheme.headline1.color, + onPressed: () { + setState(() { + currentTab = 0; + }); + + pageController.jumpToPage(0); + }, ), - textAlign: TextAlign.center, - ), - ), - ) - : SizedBox() + notificationCount != '' + ? new Positioned( + right: projectViewModel.isArabic ? 35 : 0, + top: 5, + child: new Container( + padding: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + notificationCount, + style: new TextStyle( + color: Colors.white, + fontSize: projectViewModel.isArabic ? 8 : 9, + ), + textAlign: TextAlign.center, + ), + ), + ) + : SizedBox() + ], + ); + }, + ), + actions: [ + IconButton( + //iconSize: 70, + icon: Icon( + projectViewModel.isLogin ? Icons.settings : Icons.login, + color: Theme.of(context).textTheme.headline1.color, + ), + onPressed: () { + if (projectViewModel.isLogin) + Navigator.of(context).pushNamed( + SETTINGS, + ); + else + login(); + }, //do something, + ) ], - ); - }, - ), - actions: [ - IconButton( - //iconSize: 70, - icon: Icon( - projectViewModel.isLogin ? Icons.settings : Icons.login, - color: Theme.of(context).textTheme.headline1.color, + centerTitle: true, ), - onPressed: () { - if (projectViewModel.isLogin) - Navigator.of(context).pushNamed( - SETTINGS, - ); - else - login(); - }, //do something, - ) - ], - centerTitle: true, - ), drawer: SafeArea(child: AppDrawer()), extendBody: true, body: PageView( diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 721139cc..112fb0b0 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -120,6 +120,7 @@ class _ConfirmLogin extends State { if (user != null) Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( TranslationBase.of(context).welcomeBack, @@ -160,9 +161,9 @@ class _ConfirmLogin extends State { ), Text( user.editedOn != null - ? formatDateToDate(DateUtil.convertStringToDate(user.editedOn)) + ? DateUtil.formatDateToDate(DateUtil.convertStringToDate(user.editedOn)) : user.createdOn != null - ? formatDateToDate(DateUtil.convertStringToDate(user.createdOn)) + ? DateUtil.formatDateToDate(DateUtil.convertStringToDate(user.createdOn)) : '--', style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), ), @@ -193,9 +194,9 @@ class _ConfirmLogin extends State { Expanded(child: SizedBox()), Text( user.editedOn != null - ? formatDateToTime(DateUtil.convertStringToDate(user.editedOn)) + ? DateUtil.formatDateToTime(DateUtil.convertStringToDate(user.editedOn)) : user.createdOn != null - ? formatDateToTime(DateUtil.convertStringToDate(user.createdOn)) + ? DateUtil.formatDateToTime(DateUtil.convertStringToDate(user.createdOn)) : '--', style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48), ), @@ -927,14 +928,6 @@ class _ConfirmLogin extends State { return DateFormat('MMM dd, yyy, kk:mm').format(date); } - formatDateToDate(date) { - return DateFormat('dd MMM yyy').format(date); - } - - formatDateToTime(date) { - return DateFormat('kk:mm a').format(date); - } - showLoader(bool isTrue) { setState(() { isLoading = isTrue; diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 7e37f621..782ab380 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; class WelcomeLogin extends StatefulWidget { @override @@ -21,78 +22,83 @@ class _WelcomeLogin extends State { @override void initState() { isLoading = true; - // checkUser(context); super.initState(); } Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).welcome, - isShowDecPage: false, - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: false, - body: Padding( - padding: EdgeInsets.all(20), - child: Column( + appBarTitle: TranslationBase.of(context).welcome, + isShowDecPage: false, + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: false, + body: Column( + children: [ + Expanded( + child: ListView( + padding: EdgeInsets.only(left: 21, right: 21), + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 12), + Align( + alignment: Alignment.centerLeft, + child: SvgPicture.asset( + "assets/images/new/hmg_icon.svg", + height: 35, + width: 35, + ), + ), + SizedBox(height: 16), + Text( + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 23 / 24), + ), + Text( + TranslationBase.of(context).welcomeText, + style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56, height: 21 / 14), + ), + Text( + TranslationBase.of(context).welcomeText2, + style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56, height: 21 / 14), + ), + SizedBox( + height: 14, + ), + ], + ), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, children: [ Expanded( - flex: 6, - child: Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset('assets/images/DQ/logo.png', height: 90, width: 90), - AppText( - TranslationBase.of(context).welcome, - fontSize: 30, - fontWeight: FontWeight.bold, - ), - AppText( - TranslationBase.of(context).welcomeText, - fontSize: 24, - textAlign: TextAlign.start, - ), - AppText( - TranslationBase.of(context).welcomeText2, - fontSize: 24, - textAlign: TextAlign.start, - ), - SizedBox( - height: SizeConfig.realScreenHeight * .15, - ) - ]), + child: DefaultButton( + TranslationBase.of(context).no, + () => { + Navigator.of(context).push(FadePage(page: Register())), + }, + color: Color(0xffEAEAEA), + textColor: Color(0xff000000), + ), ), + SizedBox(width: 8), Expanded( - flex: 2, - child: Column( - //mainAxisAlignment: MainAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).yes, - () => { - Navigator.of(context).push(FadePage(page: LoginType())), - }, - color: Color(0xFFc5272c), - textColor: Colors.white, - )) - ], - ), - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).no, - () => { - Navigator.of(context).push(FadePage(page: Register())), - }, - )) - ], - ), - ], - )) + child: DefaultButton( + TranslationBase.of(context).yes, + () => { + Navigator.of(context).push(FadePage(page: LoginType())), + }, + color: Color(0xff359846), + ), + ), ], - ))); + ), + ), + ], + ), + ); } } diff --git a/lib/pages/medical/labs/labs_home_page.dart b/lib/pages/medical/labs/labs_home_page.dart index ce78a7dc..0cc87224 100644 --- a/lib/pages/medical/labs/labs_home_page.dart +++ b/lib/pages/medical/labs/labs_home_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -16,96 +17,128 @@ import 'package:provider/provider.dart'; import 'laboratory_result_page.dart'; class LabsHomePage extends StatelessWidget { - List imagesInfo =List(); + List imagesInfo = List(); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/ar/0.png')); return BaseView( onModelReady: (model) => model.getLabs(), builder: (context, LabsViewModel model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: true, description: TranslationBase.of(context).infoLab, - appBarTitle: TranslationBase.of(context).labOrders, + appBarTitle: TranslationBase.of(context).labResults, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), imagesInfo: imagesInfo, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: FractionallySizedBox( - widthFactor: 1.0, - child: Center( - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Clinic), - child: ListTile( - title: Text(TranslationBase.of(context).clinic), - leading: Radio( - value: FilterType.Clinic, - groupValue: model.filterType, - onChanged: (FilterType value) { - model.setFilterType(value); + body: Column( + children: [ + Row( + children: [ + MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, model.filterType, () { + model.setFilterType(FilterType.Clinic); + }), + MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, model.filterType, () { + model.setFilterType(FilterType.Hospital); + }), + ], + ), + Expanded( + child: FractionallySizedBox( + widthFactor: 1.0, + child: ListView.separated( + physics: BouncingScrollPhysics(), + separatorBuilder: (context, index) { + return Container( + height: 1, + color: Colors.grey, + ); + }, + itemBuilder: (context, index) { + return AppExpandableNotifier( + title: model.patientLabOrdersList[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(left: 21, right: 21), + itemBuilder: (context, _index) { + PatientLabOrders labOrder = model.patientLabOrdersList[index].patientLabOrdersList[_index]; + + return DoctorCard( + onTap: () => Navigator.push( + context, + FadePage( + page: LaboratoryResultPage( + patientLabOrders: labOrder, + ), + ), + ), + isInOutPatient: labOrder.isInOutPatient, + name: labOrder.doctorName, + billNo: labOrder.projectName, + profileUrl: labOrder.doctorImageURL, + subName: labOrder.clinicDescription, + isLiveCareAppointment: labOrder.isLiveCareAppointment, + date: labOrder.orderDate + //projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), + ); }, - ), - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Hospital), - child: ListTile( - title: Text(TranslationBase.of(context).hospital), - leading: Radio( - value: FilterType.Hospital, - groupValue: model.filterType, - onChanged: (FilterType value) => - model.setFilterType(value), - ), - ), - ), - ) - ], - ), - ...List.generate( - model.patientLabOrdersList.length, - (index) => AppExpandableNotifier( - title: model.patientLabOrdersList[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: model - .patientLabOrdersList[index].patientLabOrdersList - .map((labOrder) { - return DoctorCard( - onTap: () => Navigator.push( - context, - FadePage( - page: LaboratoryResultPage( - patientLabOrders: labOrder, - ), - ), - ),isInOutPatient: labOrder.isInOutPatient, - name: labOrder.doctorName, - billNo: ' ${labOrder.invoiceNo}', - profileUrl: labOrder.doctorImageURL, - subName: labOrder.projectName, - isLiveCareAppointment: labOrder.isLiveCareAppointment, - date: projectViewModel.isArabic?DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate):DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), - ); - }).toList(), - ), - ), - ) - ], + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: model.patientLabOrdersList[index].patientLabOrdersList.length)); + }, + itemCount: model.patientLabOrdersList.length), + ), + ), + ], + ), + ), + ); + } +} + +// todo 'Sikander' move this widget to separate file, so can find easily +class MyTabView extends StatelessWidget { + final String title; + final FilterType value; + final FilterType groupValue; + final VoidCallback onPressed; + MyTabView( + this.title, + this.value, + this.groupValue, + this.onPressed, { + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Expanded( + child: InkWell( + onTap: onPressed, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 15), + Text( + title, + style: TextStyle( + fontSize: 16, + fontFamily: "Poppins", + fontWeight: FontWeight.w600, + color: value == groupValue ? Color(0xff2B353E) : Color(0xff575757), + letterSpacing: -0.48, ), ), - ), + Container( + margin: EdgeInsets.only(top: 13), + height: 3, + color: value == groupValue ? Color(0xffD02127) : Colors.transparent, + ) + ], ), ), ); diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index eddfa4e2..ec9f15e6 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -69,7 +69,9 @@ class _MedicalProfilePageState extends State { onModelReady: (model) => model.getAppointmentHistory(), builder: (_, model, widget) => AppScaffold( isShowDecPage: false, + isShowAppBar: false, baseViewModel: model, + showNewAppBar: false, isHelp: true, body: Container( child: SingleChildScrollView( diff --git a/lib/pages/medical/my_admissions_page.dart b/lib/pages/medical/my_admissions_page.dart index ff25884e..9cf6caf8 100644 --- a/lib/pages/medical/my_admissions_page.dart +++ b/lib/pages/medical/my_admissions_page.dart @@ -21,7 +21,7 @@ class _MyAdmissionsPageState extends State { children: [ DoctorCard( name: 'Dr Mohammad Aljammal', - date: 'Feb 14, 2020', + date:DateTime.now(),// 'Feb 14, 2020', profileUrl: 'https://scontent.famm4-1.fna.fbcdn.net/v/t31.0-8/30425660_1862582094040824_7851633779570222226_o.jpg?_nc_cat=101&_nc_sid=09cbfe&_nc_eui2=AeF3TI6D2_tFS5QoQsqyaCKd2zBfzh74hOzbMF_OHviE7PQdLHRwmBoIOiKyWmK9MskOshPjkU73a5EdQMA3dqnV&_nc_ohc=1feou2fDCuIAX_Ra9qB&_nc_ht=scontent.famm4-1.fna&oh=709d34d1c284de1d0aa08ed37b0ac09a&oe=5F3C5ACB', rat: 3.8, @@ -29,7 +29,7 @@ class _MyAdmissionsPageState extends State { ), DoctorCard( name: 'Dr Mohammad Aljammal', - date: 'Feb 14, 2020', + date: DateTime.now(),//'Feb 14, 2020', profileUrl: 'https://scontent.famm4-1.fna.fbcdn.net/v/t31.0-8/30425660_1862582094040824_7851633779570222226_o.jpg?_nc_cat=101&_nc_sid=09cbfe&_nc_eui2=AeF3TI6D2_tFS5QoQsqyaCKd2zBfzh74hOzbMF_OHviE7PQdLHRwmBoIOiKyWmK9MskOshPjkU73a5EdQMA3dqnV&_nc_ohc=1feou2fDCuIAX_Ra9qB&_nc_ht=scontent.famm4-1.fna&oh=709d34d1c284de1d0aa08ed37b0ac09a&oe=5F3C5ACB', rat: 3.8, @@ -46,7 +46,7 @@ class _MyAdmissionsPageState extends State { //TODO when we need it }, name: 'Dr Mohammad Aljammal', - date: 'Feb 14, 2020', + date: DateTime.now(),//'Feb 14, 2020', profileUrl: 'https://scontent.famm4-1.fna.fbcdn.net/v/t31.0-8/30425660_1862582094040824_7851633779570222226_o.jpg?_nc_cat=101&_nc_sid=09cbfe&_nc_eui2=AeF3TI6D2_tFS5QoQsqyaCKd2zBfzh74hOzbMF_OHviE7PQdLHRwmBoIOiKyWmK9MskOshPjkU73a5EdQMA3dqnV&_nc_ohc=1feou2fDCuIAX_Ra9qB&_nc_ht=scontent.famm4-1.fna&oh=709d34d1c284de1d0aa08ed37b0ac09a&oe=5F3C5ACB', rat: 4.8, diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 196b5d79..6ffd8c10 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -22,9 +22,8 @@ class _PatientSickLeavePageState extends State { @override void initState() { - imagesInfo.add(ImagesInfo( - imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/en/0.png', - imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/ar/0.png')); + imagesInfo.add( + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/ar/0.png')); super.initState(); } @@ -47,7 +46,9 @@ class _PatientSickLeavePageState extends State { itemBuilder: (context, index) => DoctorCard( isLiveCareAppointment: model.sickLeaveList[index].isLiveCareAppointment, name: model.sickLeaveList[index].doctorName, - date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.sickLeaveList[index].requestDate):DateUtil.getMonthDayYearDateFormatted(model.sickLeaveList[index].requestDate), + date: model.sickLeaveList[index].requestDate, + + // projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.sickLeaveList[index].requestDate):DateUtil.getMonthDayYearDateFormatted(model.sickLeaveList[index].requestDate), profileUrl: model.sickLeaveList[index].doctorImageURL, rat: model.sickLeaveList[index].actualDoctorRate.toDouble(), subName: model.sickLeaveList[index].projectName, diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index abf68328..7d86856e 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -91,7 +91,7 @@ class PrescriptionsPage extends StatelessWidget { subName: prescriptions.name, isInOutPatient: prescriptions.isInOutPatient, isLiveCareAppointment: prescriptions.isLiveCareAppointment, - date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + date:DateUtil.convertStringToDate(prescriptions.appointmentDate)//projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), ), ); }).toList(), diff --git a/lib/pages/medical/radiology/radiology_home_page.dart b/lib/pages/medical/radiology/radiology_home_page.dart index 2123172a..df321e12 100644 --- a/lib/pages/medical/radiology/radiology_home_page.dart +++ b/lib/pages/medical/radiology/radiology_home_page.dart @@ -97,7 +97,7 @@ class RadiologyHomePage extends StatelessWidget { profileUrl: radiology.doctorImageURL, billNo: '${radiology.invoiceNo}', subName: '${radiology.projectName}', - date: projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(radiology.orderDate):DateUtil.getMonthDayYearDateFormatted(radiology.orderDate), + date: radiology.orderDate//projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(radiology.orderDate):DateUtil.getMonthDayYearDateFormatted(radiology.orderDate), ), ); }).toList(), diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 582acb71..b5671704 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -52,6 +52,14 @@ class DateUtil { return start + "$milliseconds" + end; } + static String formatDateToDate(DateTime date) { + return DateFormat('dd MMM yyy').format(date); + } + + static String formatDateToTime(DateTime date) { + return DateFormat('kk:mm a').format(date); + } + static String yearMonthDay(DateTime dateTime) { String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}'; return dateFormat; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a4d3d484..2db2edb7 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -48,6 +48,10 @@ class TranslationBase { String get clinic => localizedValues['clinic'][locale.languageCode]; + String get byClinic => localizedValues['by-clinic'][locale.languageCode]; + + String get byHospital => localizedValues['by-hospital'][locale.languageCode]; + String get name => localizedValues['name'][locale.languageCode]; String get doctor => localizedValues['doctor'][locale.languageCode]; diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index fcfcaa94..e1f395d8 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -58,19 +58,19 @@ class LargeAvatar extends StatelessWidget { onTap: disableProfileView ? null : onTap, child: Container( decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment(-1, -1), - end: Alignment(1, 1), - colors: [ - Colors.grey[100], - Colors.grey[800], - ]), - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.08), - offset: Offset(0.0, 5.0), - blurRadius: 16.0) - ], + // gradient: LinearGradient( + // begin: Alignment(-1, -1), + // end: Alignment(1, 1), + // colors: [ + // Colors.grey[100], + // Colors.grey[800], + // ]), + // boxShadow: [ + // BoxShadow( + // color: Color.fromRGBO(0, 0, 0, 0.08), + // offset: Offset(0.0, 5.0), + // blurRadius: 16.0) + // ], borderRadius: BorderRadius.all(Radius.circular(radius)), ), width: width, diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index 108de735..73fe0ab9 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -1,29 +1,31 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; class DefaultButton extends StatelessWidget { final String text; final Function onPress; final Color textColor; final Color color; - PermissionService permission = new PermissionService(); - DefaultButton(this.text, this.onPress, {this.color, this.textColor}); + DefaultButton(this.text, this.onPress, {this.color, this.textColor = Colors.white}); + @override Widget build(BuildContext context) { - return Container( - height: 60, - child: RaisedButton( - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), - color: color != null ? color : Colors.grey[900], - textColor: color != null ? textColor : Colors.white, - child: Text( - this.text, - style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), - ), - onPressed: () =>{ this.onPress(), })); + return SizedBox( + height: 43, + width: double.infinity, + child: FlatButton( + onPressed: () { + onPress(); + }, + child: Text( + text, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + ), + // color: Color(0xffD02127), + color: color ?? const Color(0xffD02127), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + ), + ); } } diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 23e754fb..a37f8422 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -13,7 +14,7 @@ class DoctorCard extends StatelessWidget { final String name; final String subName; final double rat; - final String date; + final DateTime date; final String profileUrl; final String billNo; final Function onTap; @@ -21,177 +22,151 @@ class DoctorCard extends StatelessWidget { final bool isInOutPatient; final bool isLiveCareAppointment; - DoctorCard( - {this.name, - this.subName, - this.rat, - this.date, - this.profileUrl, - this.billNo, - this.onTap, - this.onEmailTap, - this.isInOutPatient, - this.isLiveCareAppointment = false}); + DoctorCard({this.name, this.subName, this.rat, this.date, this.profileUrl, this.billNo, this.onTap, this.onEmailTap, this.isInOutPatient, this.isLiveCareAppointment = false}); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( - margin: EdgeInsets.all(10), + height: 108, decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Theme.of(context).primaryColor, - ), borderRadius: BorderRadius.all( - Radius.circular(8.0), + Radius.circular(10.0), ), + boxShadow: [ + BoxShadow( + color: Color(0x0000000D), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], color: Colors.white), child: InkWell( onTap: onTap, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Row( + mainAxisSize: MainAxisSize.min, children: [ - Row( - children: [ - Container( - width: projectViewModel.isArabic ? 27 : 20, - height: date == null - ? projectViewModel.isArabic - ? 185 - : 100 - : 180, - decoration: BoxDecoration( - //Colors.red[900] Color(0xff404545) - color: isLiveCareAppointment - ? Color(0xff404545) - : !isInOutPatient - ? Colors.red[900] - : Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - bottomLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - topRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0), - bottomRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0), - ), - ), - child: RotatedBox( - quarterTurns: 3, - child: Center( - child: Text( - isLiveCareAppointment - ? TranslationBase.of(context) - .liveCare - .toUpperCase() - : !isInOutPatient - ? TranslationBase.of(context) - .inPatient - .toUpperCase() - : TranslationBase.of(context) - .outpatient - .toUpperCase(), - style: TextStyle(color: Colors.white), - ), - )), + Container( + width: 16, // projectViewModel.isArabic ? 27 : 20, + height: double.infinity, + alignment: Alignment.center, + // height: date == null + // ? projectViewModel.isArabic + // ? 185 + // : 100 + // : 180, + decoration: BoxDecoration( + //Colors.red[900] Color(0xff404545) + color: isLiveCareAppointment + ? Color(0xff404545) + : !isInOutPatient + ? Colors.red[900] + : Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), + topRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), + bottomRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(10.0), - child: Row( - children: [ - Expanded( - flex: 1, - child: LargeAvatar( - name: name, - url: profileUrl, - ), + ), + child: RotatedBox( + quarterTurns: 3, + child: Text( + isLiveCareAppointment + ? TranslationBase.of(context).liveCare.toUpperCase() + : !isInOutPatient + ? TranslationBase.of(context).inPatient.toUpperCase() + : TranslationBase.of(context).outpatient.toUpperCase(), + style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4, height: 16 / 10), + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only(left: 20, right: 12, top: 12, bottom: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Text( + TranslationBase.of(context).dr + " " + name, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.formatDateToDate(date), + style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).dr + - " " + - name, - bold: true, - ), - Texts( - subName, - ), - if (billNo != null) - Row( - children: [ - Texts( - '${TranslationBase.of(context).billNo}: ', - ), - Texts( - billNo, - ) - ], - ), - if (rat != null) - StarRating( - totalAverage: rat, forceStars: true), - ], - ), - ), + Text( + DateUtil.formatDateToTime(date), + style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48, height: 18 / 12), ), - if (onEmailTap != null && projectViewModel.havePrivilege(17)) - InkWell( - onTap: onEmailTap, - child: Icon( - Icons.email, - color: Theme.of(context).primaryColor, - ), - ), ], + ) + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: name, + url: profileUrl, + width: 48, + height: 48, ), - ), - if (date != null) - Divider( - height: 8, - color: Colors.grey[400], + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + myRichText(TranslationBase.of(context).clinic + ":", subName), + myRichText(TranslationBase.of(context).billNo, billNo ?? ""), + //if (rat != null) StarRating(totalAverage: rat, forceStars: true), + ], + ), ), - if (date != null) - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/Icon-awesome-calendar.png', - width: 30, - height: 30, + if (onEmailTap != null && projectViewModel.havePrivilege(17)) + InkWell( + onTap: onEmailTap, + child: Icon( + Icons.email, + color: Theme.of(context).primaryColor, ), - Expanded( - child: Texts( - date, - variant: 'bodyText', - ), - ) - ], - ) - ], - ), - ) - ], - ), + ), + ], + ), + ], + ), + ), + ) ], ), ), ); } + + Widget myRichText(String title, String value) { + return RichText( + text: TextSpan( + text: title, + style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 18 / 10), + children: [ + TextSpan( + text: " $value", + style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ) + ]), + ); + } } diff --git a/lib/widgets/others/app_expandable_notifier.dart b/lib/widgets/others/app_expandable_notifier.dart index 1a837f9f..ff41fd96 100644 --- a/lib/widgets/others/app_expandable_notifier.dart +++ b/lib/widgets/others/app_expandable_notifier.dart @@ -18,18 +18,12 @@ class AppExpandableNotifier extends StatefulWidget { final bool isExpand; bool expandFlag = false; var controller = new ExpandableController(); - AppExpandableNotifier( - {this.headerWidget, - this.bodyWidget, - this.title, - this.collapsed, - this.isExpand = false}); + AppExpandableNotifier({this.headerWidget, this.bodyWidget, this.title, this.collapsed, this.isExpand = false}); _AppExpandableNotifier createState() => _AppExpandableNotifier(); } class _AppExpandableNotifier extends State { - @override void initState() { setState(() { @@ -43,84 +37,60 @@ class _AppExpandableNotifier extends State { @override Widget build(BuildContext context) { - return ExpandableNotifier( - child: Padding( - padding: const EdgeInsets.only(left: 10, right: 10, top: 4), - child: Card( - clipBehavior: Clip.antiAlias, - child: Column( - children: [ - SizedBox( - child: widget.headerWidget, + child: Column( + children: [ + SizedBox( + child: widget.headerWidget, + ), + ScrollOnExpand( + scrollOnExpand: true, + scrollOnCollapse: false, + child: ExpandablePanel( + hasIcon: false, + theme: const ExpandableThemeData( + headerAlignment: ExpandablePanelHeaderAlignment.center, + tapBodyToCollapse: true, ), - ScrollOnExpand( - scrollOnExpand: true, - scrollOnCollapse: false, - child: ExpandablePanel( - hasIcon: false, - theme: const ExpandableThemeData( - headerAlignment: ExpandablePanelHeaderAlignment.center, - tapBodyToCollapse: true, - ), - header: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.all(10), - child: Text( - widget.title ?? TranslationBase.of(context).details, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2, - ), - ), - ), - ), - IconButton( - icon: new Container( - height: 28.0, - width: 30.0, - decoration: new BoxDecoration( - color: secondaryColor, - shape: BoxShape.circle, - ), - child: new Center( - child: new Icon( - widget.expandFlag - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down, - color: Colors.white, - size: 30.0, - ), - ), - ), - onPressed: () { - setState(() { - widget.expandFlag = !widget.expandFlag; - widget.controller.expanded = widget.expandFlag; - }); - }), - ]), - collapsed: widget.collapsed ?? Container(), - expanded: widget.bodyWidget, - builder: (_, collapsed, expanded) { - return Padding( - padding: EdgeInsets.only(left: 5, right: 5, bottom: 5), - child: Expandable( - controller: widget.controller, - collapsed: collapsed, - expanded: expanded, - theme: const ExpandableThemeData(crossFadePoint: 0), + header: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(10), + child: Text( + widget.title ?? TranslationBase.of(context).details, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2, ), - ); - }, + ), + ), ), - ), - ], + IconButton( + icon: Icon( + widget.expandFlag ? Icons.remove : Icons.add, + color: Color(0xff2E303A), + // size: 30.0, + ), + onPressed: () { + setState(() { + widget.expandFlag = !widget.expandFlag; + widget.controller.expanded = widget.expandFlag; + }); + }), + ]), + collapsed: widget.collapsed ?? Container(), + expanded: widget.bodyWidget, + builder: (_, collapsed, expanded) { + return Expandable( + controller: widget.controller, + collapsed: collapsed, + expanded: expanded, + theme: const ExpandableThemeData(crossFadePoint: 0), + ); + }, + ), ), - ), + ], ), ); } diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index dcef2c67..0873b65a 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -161,7 +161,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { ProjectViewModel projectViewModel = Provider.of(context); return AppBar( elevation: 0, - backgroundColor: Colors.transparent, + backgroundColor: showTitle ? Colors.white : Colors.transparent, automaticallyImplyLeading: false, title: Row( children: [