From 2d62822536546706611c2fe35ac79732b27150e8 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Mon, 9 Aug 2021 16:50:44 +0300 Subject: [PATCH] Medical Profile Page improvements --- assets/images/new/empty.svg | 10 + lib/config/localized_values.dart | 1 + lib/uitl/translations_delegate_base.dart | 1 + .../medical/time_line_new_widget.dart | 252 ++++++++++++------ 4 files changed, 184 insertions(+), 80 deletions(-) create mode 100644 assets/images/new/empty.svg diff --git a/assets/images/new/empty.svg b/assets/images/new/empty.svg new file mode 100644 index 00000000..6a0ddab4 --- /dev/null +++ b/assets/images/new/empty.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index fabb6b50..ee637521 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -445,6 +445,7 @@ const Map localizedValues = { "ServiceInformationTitle": {"en": "Service Information", "ar": "معلومات الخدمة"}, "ServiceInformation": {"en": "Service Information", "ar": "معلومات الخدمة"}, "HomeHealthCare": {"en": "Home Health Care", "ar": " الرعاية الصحية المنزلية "}, + "noAppointmentAvailable": {"en": "No Available Appointments", "ar": "لا توجد مواعيد متاحة"}, "HomeHealthCareText": { "en": "This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.", diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 7c605fec..7c2a61ed 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1783,6 +1783,7 @@ class TranslationBase { String get livecareOption2 => localizedValues["livecare-option-2"][locale.languageCode]; String get livecareOption3 => localizedValues["livecare-option-3"][locale.languageCode]; + String get noAppointmentAvailable => localizedValues["noAppointmentAvailable"][locale.languageCode]; String get livecareOption4 => localizedValues["livecare-option-4"][locale.languageCode]; 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 2e698e53..458875ed 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -1,15 +1,23 @@ import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.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/data_display/list/flexible_container.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class TimeLineView extends StatefulWidget { @@ -76,107 +84,191 @@ class _TimeLineViewState extends State { width: double.infinity, height: 210, decoration: containerBottomRightRadiusWithGradientBorder(0, darkColor: Color(0xFFF2B353E), lightColor: Color(0xFFF2B353E)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - widget.isLogged? mFlex(2):mHeight(12), - Padding( - padding: EdgeInsets.only(left: 12, right: 12), - child: Row( + child: widget.isLogged && tempList.length > 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + mFlex(2), + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: Row( children: [ - Text( - TranslationBase.of(context).appointments, - style: TextStyle( - color: CustomColors.white, - fontSize: 14, - fontWeight: FontWeight.bold, - ), - ), - Text( - TranslationBase.of(context).timeLine, - style: TextStyle( - color: CustomColors.white, - fontSize: 24, - 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( + 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), 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, - ), + 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() + : Container(), ], - ), - ), - mFlex(1), - 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, + ) + : emptyView(widget.isLogged), + ); + } + + Widget emptyView(bool isLogged) { + return Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + mFlex(2), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).appointments, + style: TextStyle( + color: CustomColors.white, + fontSize: 14, + fontWeight: FontWeight.bold, ), ), - itemCount: tempList.length, - scrollDirection: Axis.horizontal, - shrinkWrap: false, - physics: BouncingScrollPhysics(), - separatorBuilder: (BuildContext context, int index) { - return mWidth(8); - }, + Text( + TranslationBase.of(context).timeLine, + style: TextStyle( + color: CustomColors.white, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + mFlex(1), + Text( + isLogged ? TranslationBase.of(context).noAppointmentAvailable : TranslationBase.of(context).cantSeeProfile, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 14, ), - ) - : Container(), + ), + mHeight(4), + !isLogged + ? Container( + height: MediaQuery.of(context).size.width / 14, + width: MediaQuery.of(context).size.width / (widget.isArabic ? 4 : 6), + child: RaisedButton( + shape: cardRadius(8), + color: Color(0xFFFBF2E31), + padding: EdgeInsets.zero, + onPressed: () { + // onLoginClick(); + login(); + }, + child: Center( + child: AutoSizeText( + TranslationBase.of(context).login, + maxLines: 1, + style: TextStyle(color: Colors.white, fontSize: 14), + ), + ), + ), + ) + : Container( + height: MediaQuery.of(context).size.width / 14, + ), + mFlex(3), + ], + ), + ), + SvgPicture.asset("assets/images/new/empty.svg"), + mWidth(20), ], ), ); } + + login() async { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } } class TimelineNewWidget extends StatelessWidget {