From bbaeec5b85874c180514aceba277be81f6ec2040 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Mon, 9 Aug 2021 11:50:43 +0300 Subject: [PATCH] Medical Profile Complete --- lib/config/localized_values.dart | 4 +- .../landing/fragments/home_page_fragment.dart | 2 +- .../fragments/logged_home_page_fragment.dart | 4 +- .../medical/medical_profile_page_new.dart | 8 +- lib/uitl/date_uitl.dart | 118 +++------- lib/uitl/translations_delegate_base.dart | 103 +++++++++ lib/uitl/utils.dart | 1 + .../medical/medical_profile_item.dart | 13 +- .../medical/time_line_new_widget.dart | 206 ++++++++++++++---- pubspec.yaml | 1 + 10 files changed, 313 insertions(+), 147 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 8ecbb590..8c044739 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -298,6 +298,8 @@ const Map localizedValues = { "NoConfirmedAppointments": {"en": "No Confirmed Appointments", "ar": "لا توجد مواعيد مؤكدة"}, "noArrivedAppointments": {"en": "No Arrived Appointments", "ar": "لم تصل المواعيد"}, "MyAppointmentsList": {"en": "Appointments", "ar": "قائمة بمواعدي"}, + "appointments": {"en": "Appointments", "ar": "تعيينات"}, + "all2": {"en": "All", "ar": "الكل"}, "Radiology": {"en": "Radiology", "ar": "الأشعة"}, "RadiologySubtitle": {"en": "Result", "ar": "صور وتقارير"}, "Lab": {"en": "Lab", "ar": "تحليل المختبر"}, @@ -342,7 +344,7 @@ const Map localizedValues = { "InternetSubtitle": {"en": "Pairing", "ar": "بالإنترنت"}, "Chatbot": {"en": "Chatbot", "ar": "تاشت بوت"}, "ChatbotSubtitle": {"en": "", "ar": ""}, - "TimeLine": {"en": "Time Line", "ar": "الجدول الزمني"}, + "TimeLine": {"en": "Timeline", "ar": "الجدول الزمني"}, "LabOrders": {"en": "Lab Orders", "ar": "تحاليل المختبر"}, "BillNo": {"en": "Bill No :", "ar": "رقم الفاتورة"}, "Prescriptions": {"en": "Prescriptions", "ar": "الوصفات الطبية"}, diff --git a/lib/pages/landing/fragments/home_page_fragment.dart b/lib/pages/landing/fragments/home_page_fragment.dart index b53e7a07..b17d28ad 100644 --- a/lib/pages/landing/fragments/home_page_fragment.dart +++ b/lib/pages/landing/fragments/home_page_fragment.dart @@ -47,7 +47,7 @@ class _HomePageFragmentState extends State { child: Column( children: [ AspectRatio( - aspectRatio: 2.2, + aspectRatio: 2.3, child: Container( margin: EdgeInsets.only(left: 14,right: 14,top: 10,bottom: 10), child: SliderView( diff --git a/lib/pages/landing/fragments/logged_home_page_fragment.dart b/lib/pages/landing/fragments/logged_home_page_fragment.dart index 9f96f4a2..17a6f71d 100644 --- a/lib/pages/landing/fragments/logged_home_page_fragment.dart +++ b/lib/pages/landing/fragments/logged_home_page_fragment.dart @@ -87,9 +87,9 @@ class _HomePageFragmentState extends State { child: Column( children: [ AspectRatio( - aspectRatio: 2.2, + aspectRatio: 2.3, child: Padding( - padding: const EdgeInsets.only(left: 20,right: 20,top: 16,bottom: 16), + padding: const EdgeInsets.only(left: 20, right: 20, top: 16, bottom: 16), child: LoggedSliderView( widget.projectViewModel, new SliderData(TranslationBase.of(context).fileno + ": " + widget.projectViewModel.user.patientID.toString(), diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index 6875debc..eddfa4e2 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -95,7 +95,7 @@ class _MedicalProfilePageState extends State { // ], // ), // ), - //TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList), + TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList), SizedBox( height: 20, ), @@ -112,7 +112,11 @@ class _MedicalProfilePageState extends State { : Container(), Text( TranslationBase.of(context).medicalFile, - style: TextStyle(color: Colors.black, fontSize: SizeConfig.textMultiplier * 3), + style: TextStyle( + color: Colors.black, + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ), ), ], ), diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 85e2e0e0..b3657143 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -4,7 +4,8 @@ import 'package:intl/intl.dart'; class DateUtil { /// convert String To Date function /// [date] String we want to convert - static DateTime convertStringToDate(String date) { // /Date(1585774800000+0300)/ + static DateTime convertStringToDate(String date) { + // /Date(1585774800000+0300)/ if (date != null) { const start = "/Date("; const end = "+0300)"; @@ -24,8 +25,7 @@ class DateUtil { try { var dateT = date.split('/'); var year = dateT[2].substring(0, 4); - var dateP = - DateTime(int.parse(year), int.parse(dateT[1]), int.parse(dateT[0])); + var dateP = DateTime(int.parse(year), int.parse(dateT[1]), int.parse(dateT[0])); return dateP; } catch (e) { print(e); @@ -66,12 +66,9 @@ class DateUtil { /// [dateString] String we want to convert static String checkDate(DateTime checkedTime) { DateTime currentTime = DateTime.now(); - if ((currentTime.year == checkedTime.year) && - (currentTime.month == checkedTime.month) && - (currentTime.day == checkedTime.day)) { + if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month) && (currentTime.day == checkedTime.day)) { return "Today"; - } else if ((currentTime.year == checkedTime.year) && - (currentTime.month == checkedTime.month)) { + } else if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month)) { if ((currentTime.day - checkedTime.day) == 1) { return "YESTERDAY"; } else if ((currentTime.day - checkedTime.day) == -1) { @@ -89,13 +86,7 @@ class DateUtil { static String getDateFormatted(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); - return DateUtil.getWeekDay(dateObj.weekday) + - ", " + - dateObj.day.toString() + - " " + - DateUtil.getMonth(dateObj.month) + - " " + - dateObj.year.toString(); + return DateUtil.getWeekDay(dateObj.weekday) + ", " + dateObj.day.toString() + " " + DateUtil.getMonth(dateObj.month) + " " + dateObj.year.toString(); } /// get month by @@ -245,85 +236,54 @@ class DateUtil { /// [dateTime] convert DateTime to data formatted static String getMonthDayYearDateFormatted(DateTime dateTime) { if (dateTime != null) - return getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } + /// get data formatted like Apr 26,2020 /// [dateTime] convert DateTime to data formatted Arabic static String getMonthDayYearDateFormattedAr(DateTime dateTime) { if (dateTime != null) - return getMonthArabic(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } /// get data formatted like Thursday, Apr 26,2020 /// [dateTime] convert DateTime to date formatted - static String getWeekDayMonthDayYearDateFormatted( - DateTime dateTime, String lang) { + static String getWeekDayMonthDayYearDateFormatted(DateTime dateTime, String lang) { if (dateTime != null) return lang == 'en' - ? getDay(dateTime.weekday.getDayOfWeekEnumValue) + - ", " + - getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - " " + - dateTime.year.toString() - : getWeekDayArabic(dateTime.weekday) + - ", " + - dateTime.day.toString() + - " " + - getMonthArabic(dateTime.month) + - " " + - dateTime.year.toString(); + ? getDay(dateTime.weekday.getDayOfWeekEnumValue) + ", " + getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString() + : getWeekDayArabic(dateTime.weekday) + ", " + dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); else return ""; } - static String getMonthDayYearLangDateFormatted( - DateTime dateTime, String lang) { + static String getMonthDayYearLangDateFormatted(DateTime dateTime, String lang) { if (dateTime != null) return lang == 'en' - ? getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - " " + - dateTime.year.toString() - : dateTime.day.toString() + - " " + - getMonthArabic(dateTime.month) + - " " + - dateTime.year.toString(); + ? getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString() + : dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); else return ""; } /// get data formatted like 26/4/2020 - static String getDayMonthYearLangDateFormatted( - DateTime dateTime, String lang) { + static String getDayMonthYearLangDateFormatted(DateTime dateTime, String lang) { if (dateTime != null) return lang == 'en' - ? dateTime.day.toString() + - " " + - getMonth(dateTime.month) + + ? dateTime.day.toString() + " " + getMonth(dateTime.month) + " " + dateTime.year.toString() + : dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); + else + return ""; + } - " " + - dateTime.year.toString() - : dateTime.day.toString() + - " " + - getMonthArabic(dateTime.month) + - " " + - dateTime.year.toString(); + /// get data formatted like Augast/2020 + static String getMonthYearLangDateFormatted(DateTime dateTime, String lang) { + if (dateTime != null) + return lang == 'en' ? getMonth(dateTime.month) + " " + dateTime.year.toString() : getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); else return ""; } @@ -332,11 +292,7 @@ class DateUtil { /// [dateTime] convert DateTime to data formatted static String getDayMonthYearDateFormatted(DateTime dateTime) { if (dateTime != null) - return dateTime.day.toString() + - "/" + - dateTime.month.toString() + - "/" + - dateTime.year.toString(); + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString(); else return ""; } @@ -345,15 +301,7 @@ class DateUtil { /// [dateTime] convert DateTime to data formatted static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) { if (dateTime != null) - return dateTime.day.toString() + - "/" + - dateTime.month.toString() + - "/" + - dateTime.year.toString() + - " " + - dateTime.hour.toString() + - ":" + - dateTime.minute.toString(); + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString() + " " + dateTime.hour.toString() + ":" + dateTime.minute.toString(); else return ""; } @@ -377,18 +325,12 @@ class DateUtil { return ""; } - static String getFormattedDate(DateTime dateTime, String formattedString){ - return DateFormat(formattedString) - .format(dateTime); + static String getFormattedDate(DateTime dateTime, String formattedString) { + return DateFormat(formattedString).format(dateTime); } static convertISODateToJsonDate(String isoDate) { - return "/Date(" + - DateFormat('mm-dd-yyy') - .parse(isoDate) - .millisecondsSinceEpoch - .toString() + - ")/"; + return "/Date(" + DateFormat('mm-dd-yyy').parse(isoDate).millisecondsSinceEpoch.toString() + ")/"; } static String getDay(DayOfWeek dayOfWeek) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 2602b92f..cb7705dc 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -133,18 +133,23 @@ class TranslationBase { String get no => localizedValues['no'][locale.languageCode]; String get logintypeRadio => localizedValues['logintyperadio'][locale.languageCode]; + String get registerInfoFamily => localizedValues['register-info-family'][locale.languageCode]; String get registerNow => localizedValues['registernow'][locale.languageCode]; String get nationalID => localizedValues['nationalID'][locale.languageCode]; + String get medicalFileNumber => localizedValues['medical-file-number'][locale.languageCode]; + String get nationalIdNumber => localizedValues['national-id-number'][locale.languageCode]; String get idNo => localizedValues['national-id'][locale.languageCode]; String get fileNo => localizedValues['fileNo'][locale.languageCode]; + String get fileno => localizedValues['fileno'][locale.languageCode]; + String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; String get forgotFileNoTitle => localizedValues['forgotFileNoTitle'][locale.languageCode]; @@ -204,6 +209,7 @@ class TranslationBase { String get upcomingConfirm => localizedValues['upcoming-confirm'][locale.languageCode]; String get upcomingPaymentPending => localizedValues['upcoming-payment-pending'][locale.languageCode]; + String get upcomingConfirmMore => localizedValues['book-success-confirm-more-24-1-2'][locale.languageCode]; String get upcomingPaymentNow => localizedValues['upcoming-payment-now'][locale.languageCode]; @@ -250,6 +256,10 @@ class TranslationBase { String get refferal => localizedValues['refferal'][locale.languageCode]; + String get appointments => localizedValues['appointments'][locale.languageCode]; + + String get all2 => localizedValues['all2'][locale.languageCode]; + String get healthCare => localizedValues['healthCare'][locale.languageCode]; String get emergency => localizedValues['emergency'][locale.languageCode]; @@ -273,6 +283,7 @@ class TranslationBase { String get pharmaciesList => localizedValues['pharmaciesList'][locale.languageCode]; String get description => localizedValues['description'][locale.languageCode]; + String get howToUse => localizedValues['howToUse'][locale.languageCode]; String get price => localizedValues['price'][locale.languageCode]; @@ -292,14 +303,23 @@ class TranslationBase { String get appsetting => localizedValues['app-settings'][locale.languageCode]; String get rateApp => localizedValues['rate-app'][locale.languageCode]; + String get setReminder => localizedValues['set-reminder'][locale.languageCode]; + String get before => localizedValues['before'][locale.languageCode]; + String get minute => localizedValues['minute'][locale.languageCode]; + String get hour => localizedValues['hour'][locale.languageCode]; + String get reminderSuccess => localizedValues['reminderSuccess'][locale.languageCode]; + String get patientShareToDo => localizedValues['patientShareToDo'][locale.languageCode]; + String get patientTaxToDo => localizedValues['patientTaxToDo'][locale.languageCode]; + String get patientShareTotalToDo => localizedValues['patientShareTotalToDo'][locale.languageCode]; + String get paymentMethod => localizedValues['paymentMethod'][locale.languageCode]; String get moreVerification => localizedValues['more-verify'][locale.languageCode]; @@ -313,12 +333,19 @@ class TranslationBase { String get next => localizedValues['next'][locale.languageCode]; String get noNeedToWaitInLine => localizedValues['noNeedToWaitInLine'][locale.languageCode]; + String get useQRAppoAttend => localizedValues['useQRAppoAttend'][locale.languageCode]; + String get passQRAppoAttend => localizedValues['passQRAppoAttend'][locale.languageCode]; + String get sitWaitingQR => localizedValues['sitWaitingQR'][locale.languageCode]; + String get attendRegisterCode => localizedValues['attendRegisterCode'][locale.languageCode]; + String get scanQRHospital => localizedValues['scanQRHospital'][locale.languageCode]; + String get sendEmail => localizedValues['sendEmail'][locale.languageCode]; + String get close => localizedValues['close'][locale.languageCode]; String get booked => localizedValues['booked'][locale.languageCode]; @@ -712,8 +739,11 @@ class TranslationBase { String get depositorName => localizedValues['DepositorName'][locale.languageCode]; String get mobileNumber => localizedValues['MobileNumber'][locale.languageCode]; + String get phoneNumber => localizedValues['phone-number'][locale.languageCode]; + String get country => localizedValues['country'][locale.languageCode]; + String get ok => localizedValues['Ok'][locale.languageCode]; String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode]; @@ -777,12 +807,19 @@ class TranslationBase { String get scheduleTime => localizedValues['ScheduleTime'][locale.languageCode]; String get askDoctor => localizedValues['AskDoctor'][locale.languageCode]; + String get doctorResponses => localizedValues['DoctorResponses'][locale.languageCode]; + String get newDes => localizedValues['New'][locale.languageCode]; + String get all => localizedValues['All'][locale.languageCode]; + String get questionHere => localizedValues['QuestionHere'][locale.languageCode]; + String get viewDoctorResponses => localizedValues['ViewDoctorResponses'][locale.languageCode]; + String get serviceInformationButton => localizedValues['ServiceInformationButton'][locale.languageCode]; + String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; String get infoLab => localizedValues['info-lab'][locale.languageCode]; @@ -792,78 +829,144 @@ class TranslationBase { String get orders => localizedValues['orders'][locale.languageCode]; String get lakum => localizedValues['lakum'][locale.languageCode]; + String get wishlist => localizedValues['wishlist'][locale.languageCode]; + String get reviews => localizedValues['reviews'][locale.languageCode]; + String get myPrescriptions => localizedValues['myPrescriptions'][locale.languageCode]; + String get medicationRefill => localizedValues['medicationRefill'][locale.languageCode]; + String get pillReminder => localizedValues['pillReminder'][locale.languageCode]; + String get shippingAddresses => localizedValues['shippingAddresses'][locale.languageCode]; + String get reachUs => localizedValues['reachUs'][locale.languageCode]; + String get ourLocations => localizedValues['ourLocations'][locale.languageCode]; + String get edit => localizedValues['edit'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; + String get addAddress => localizedValues['addAddress'][locale.languageCode]; + String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode]; + String get order => localizedValues['order'][locale.languageCode]; + String get delivered => localizedValues['delivered'][locale.languageCode]; + String get processing => localizedValues['processing'][locale.languageCode]; + String get pending => localizedValues['pending'][locale.languageCode]; + String get cancelled => localizedValues['cancelled'][locale.languageCode]; + String get writeReview => localizedValues['writeReview'][locale.languageCode]; + String get shareReview => localizedValues['shareReview'][locale.languageCode]; + String get backMyAccount => localizedValues['backMyAccount'][locale.languageCode]; + String get reviewSuccessful => localizedValues['reviewSuccessful'][locale.languageCode]; + String get reviewShared => localizedValues['reviewShared'][locale.languageCode]; + String get reviewComment => localizedValues['reviewComment'][locale.languageCode]; + String get shippedMethod => localizedValues['shippedMethod'][locale.languageCode]; + String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; + String get deliveryDriverTrack => localizedValues['DeliveryDriverTrack'][locale.languageCode]; + String get deliveryLocation => localizedValues['DeliveryLocation'][locale.languageCode]; + String get driver => localizedValues['Driver'][locale.languageCode]; + String get subtotal => localizedValues['subtotal'][locale.languageCode]; + String get shipping => localizedValues['shipping'][locale.languageCode]; + String get shipBy => localizedValues['shipBy'][locale.languageCode]; + String get lakumPoints => localizedValues['lakumPoints'][locale.languageCode]; + String get use => localizedValues['use'][locale.languageCode]; + String get proceedPay => localizedValues['proceedPay'][locale.languageCode]; + String get vat => localizedValues['vat'][locale.languageCode]; + String get inclusiveVat => localizedValues['inclusiveVat'][locale.languageCode]; + String get items => localizedValues['items'][locale.languageCode]; + String get checkOut => localizedValues['checkOut'][locale.languageCode]; + String get total => localizedValues['total'][locale.languageCode]; + String get sar => localizedValues['sar'][locale.languageCode]; + String get payOnline => localizedValues['payOnline'][locale.languageCode]; + String get cancelOrder => localizedValues['cancelOrder'][locale.languageCode]; + String get confirmAddress => localizedValues['confirmAddress'][locale.languageCode]; + String get confirmLocation => localizedValues['confirmLocation'][locale.languageCode]; + String get confirmDeleteMsg => localizedValues['confirmDeleteMsg'][locale.languageCode]; + String get confirmDelete => localizedValues['confirmDelete'][locale.languageCode]; + String get confirmCancellation => localizedValues['confirmCancellation'][locale.languageCode]; + String get serviceInformation => localizedValues['ServiceInformation'][locale.languageCode]; + String get homeHealthCare => localizedValues['HomeHealthCare'][locale.languageCode]; + String get HHCNotAuthMsg => localizedValues['HHCNotAuthMsg'][locale.languageCode]; + String get homeHealthCareText => localizedValues['HomeHealthCareText'][locale.languageCode]; + String get loginRegister => localizedValues['LoginRegister'][locale.languageCode]; + String get orderLog => localizedValues['OrderLog'][locale.languageCode]; // String get infoLab => localizedValues['info-lab'][locale.languageCode]; // String get infoRadiology => String get orderNumber => localizedValues['orderNumber'][locale.languageCode]; + String get orderDate => localizedValues['orderDate'][locale.languageCode]; + String get itemsNo => localizedValues['itemsNo'][locale.languageCode]; + String get noOrder => localizedValues['noOrder'][locale.languageCode]; + String get noResult => localizedValues['noResult'][locale.languageCode]; String get offersAndPromotions => localizedValues['offersAndPromotions'][locale.languageCode]; + String get review => localizedValues['review'][locale.languageCode]; + String get deliveredOrder => localizedValues['deliveredOrder'][locale.languageCode]; + String get pendingOrder => localizedValues['pendingOrder'][locale.languageCode]; + String get processingOrder => localizedValues['processingOrder'][locale.languageCode]; + String get cancelledOrder => localizedValues['cancelledOrder'][locale.languageCode]; + String get compare => localizedValues['compare'][locale.languageCode]; + String get medicationsRefill => localizedValues['medicationsRefill'][locale.languageCode]; + String get myPrescription => localizedValues['myPrescription'][locale.languageCode]; + String get quantity => localizedValues['quantity'][locale.languageCode]; String get conditionsHMG => localizedValues['conditionsHMG'][locale.languageCode]; diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 17b92bbb..d3e703aa 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -213,6 +213,7 @@ class Utils { top: 4, child: Badge( toAnimate: false, + elevation: 0, position: BadgePosition.topEnd(), shape: BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index a77ab937..80784b74 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -53,14 +53,15 @@ class MedicalProfileItem extends StatelessWidget { mFlex(1), SvgPicture.asset( "assets/images/new/services/$imagePath", - height: SizeConfig.heightMultiplier * 4, - width: SizeConfig.heightMultiplier * 4, + height: SizeConfig.widthMultiplier * 7, + width: SizeConfig.widthMultiplier * 7, ), mFlex(2), Text( title, + maxLines: 1, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.bold, ), ), @@ -69,11 +70,11 @@ class MedicalProfileItem extends StatelessWidget { child: Row( children: [ Expanded( - child: AutoSizeText( + child: Text( subTitle, maxLines: 1, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.bold, ), ), @@ -90,7 +91,7 @@ class MedicalProfileItem extends StatelessWidget { : Container( width: double.infinity, height: double.infinity, - color: Colors.grey.withOpacity(0.7), + color: Colors.grey.withOpacity(0.6), child: Icon( Icons.lock_outline, size: 40, diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index 0452c5b6..2e698e53 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -1,9 +1,14 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; import 'package:diplomaticquarterapp/theme/colors.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/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -18,6 +23,53 @@ class TimeLineView extends StatefulWidget { } class _TimeLineViewState extends State { + List tempList = []; + List dateObjs = []; + DateObj selectedDateObj = null; + + @override + void initState() { + super.initState(); + dateObjs.add(new DateObj(0, 0, widget.isArabic ? "الكل" : "All")); + for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { + tempList.add(widget.appoitmentAllHistoryResultList[i]); + dateObjs.add(new DateObj( + DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate).month, + DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate).year, + DateUtil.getMonthYearLangDateFormatted( + DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate), + widget.isArabic ? "ar" : "en", + ))); + } + dateObjs = dateObjs.toSet().toList(); + dateObjs.sort((a, b) => a.month.compareTo(b.month)); + dateObjs.sort((a, b) => a.year.compareTo(b.year)); + + // for (int i = 0; i < dateObjs.length; i++) { + // print(dateObjs[i].monthYear.toString()); + // } + } + + applyFilter(bool isAll) { + tempList.clear(); + if (isAll) { + for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { + tempList.add(widget.appoitmentAllHistoryResultList[i]); + } + } else { + for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { + if (DateUtil.getMonthYearLangDateFormatted( + DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate), + widget.isArabic ? "ar" : "en", + ) == + selectedDateObj.monthYear) { + tempList.add(widget.appoitmentAllHistoryResultList[i]); + } + } + } + setState(() {}); + } + @override Widget build(BuildContext context) { return Container( @@ -28,52 +80,99 @@ class _TimeLineViewState extends State { crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - mFlex(2), + widget.isLogged? mFlex(2):mHeight(12), Padding( padding: EdgeInsets.only(left: 12, right: 12), child: Row( children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Appointments", - style: TextStyle( - color: CustomColors.white, - fontSize: 14, - fontWeight: FontWeight.bold, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).appointments, + style: TextStyle( + color: CustomColors.white, + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), - ), - Text( - "Timeline", - style: TextStyle( - color: CustomColors.white, - fontSize: 24, - fontWeight: FontWeight.bold, + Text( + TranslationBase.of(context).timeLine, + style: TextStyle( + color: CustomColors.white, + fontSize: 24, + fontWeight: FontWeight.bold, + ), ), - ), - ], + ], + ), ), + widget.isLogged + ? Container( + decoration: containerRadius(Color(0xFF2B2E31), 100), + height: 30, + child: DropdownButtonHideUnderline( + child: ButtonTheme( + alignedDropdown: true, + child: DropdownButton( + hint: Text( + TranslationBase.of(context).all, + style: TextStyle(color: CustomColors.grey2, fontSize: 10), + ), + iconEnabledColor: CustomColors.grey2, + style: TextStyle(color: CustomColors.grey2, fontSize: 10), + dropdownColor: Color(0xFF2B2E31), + value: selectedDateObj, + items: dateObjs.map((DateObj value) { + return DropdownMenuItem( + value: value, + child: new AutoSizeText( + value.monthYear, + ), + ); + }).toList(), + onChanged: (r) { + selectedDateObj = r; + applyFilter(r.year == 0 ? true : false); + setState(() {}); + }, + underline: Container( + height: 0, + ), + ), + ), + ), + ) + : Container() ], ), ), mFlex(1), - Container( - height: 110, - width: double.infinity, - child: ListView.builder( - itemBuilder: (context, index) => Padding( - padding: EdgeInsets.only(left: index==0?12:0,right: (widget.appoitmentAllHistoryResultList.length-1) != null?20:0), - child: TimelineNewWidget( - appoitmentAllHistoryResul: widget.appoitmentAllHistoryResultList[index], - ), - ), - itemCount: widget.appoitmentAllHistoryResultList.length, - scrollDirection: Axis.horizontal, - shrinkWrap: false, - reverse: widget.isArabic, - ), - ), + widget.isLogged + ? Container( + height: widget.isArabic ? 130 : 110, + width: double.infinity, + child: ListView.separated( + itemBuilder: (context, index) => Padding( + padding: widget.isArabic + ? EdgeInsets.only(left: index == 0 ? 0 : 12, right: (tempList.length - 1) == index ? 0 : 12) + : EdgeInsets.only(left: index == 0 ? 12 : 0, right: (tempList.length - 1) == index ? 12 : 0), + child: TimelineNewWidget( + appoitmentAllHistoryResul: tempList[index], + isLast: tempList.length - 1 == index ? true : false, + ), + ), + itemCount: tempList.length, + scrollDirection: Axis.horizontal, + shrinkWrap: false, + physics: BouncingScrollPhysics(), + separatorBuilder: (BuildContext context, int index) { + return mWidth(8); + }, + ), + ) + : Container(), ], ), ); @@ -81,15 +180,16 @@ class _TimeLineViewState extends State { } class TimelineNewWidget extends StatelessWidget { + bool isLast; final AppoitmentAllHistoryResultList appoitmentAllHistoryResul; - TimelineNewWidget({Key key, this.appoitmentAllHistoryResul}); + TimelineNewWidget({Key key, this.appoitmentAllHistoryResul, this.isLast}); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( - width: MediaQuery.of(context).size.width / 1.6, + width: MediaQuery.of(context).size.width / 2.3, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, @@ -107,20 +207,20 @@ class TimelineNewWidget extends StatelessWidget { color: CustomColors.grey2, ), ), - barView(), + mWidth(8), + isLast ? Container() : barView(), ], ), ), mHeight(10), LargeAvatar( onTap: () { - //AppointmentDetails - // Navigator.push( - // context, - // FadePage( - // page: AppointmentDetails( - // appo: appoitmentAllHistoryResul, - // ))); + Navigator.push( + context, + FadePage( + page: AppointmentDetails( + appo: appoitmentAllHistoryResul, + ))); }, name: appoitmentAllHistoryResul.doctorNameObj, url: appoitmentAllHistoryResul.doctorImageURL, @@ -132,14 +232,14 @@ class TimelineNewWidget extends StatelessWidget { appoitmentAllHistoryResul.doctorNameObj, style: TextStyle( color: CustomColors.white, - fontSize: 14, + fontSize: 12, ), ), Text( appoitmentAllHistoryResul.clinicName, style: TextStyle( color: CustomColors.grey2, - fontSize: 10, + fontSize: 8, fontWeight: FontWeight.bold, ), ), @@ -177,3 +277,15 @@ class TimelineNewWidget extends StatelessWidget { ); } } + +// ignore: must_be_immutable +class DateObj extends Equatable { + int month; + int year; + String monthYear; + + DateObj(this.month, this.year, this.monthYear); + + @override + List get props => [monthYear]; +} diff --git a/pubspec.yaml b/pubspec.yaml index f7064e86..68ee1b26 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -190,6 +190,7 @@ dependencies: # Marker Animation flutter_animarker: ^1.0.0 auto_size_text: ^2.0.1 + equatable: ^1.2.5 dev_dependencies: flutter_test: