You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PatientApp-KKUMC/lib/widgets/data_display/medical/doctor_card.dart

305 lines
14 KiB
Dart

import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
2 years ago
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.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_countdown_timer/countdown_timer_controller.dart';
import 'package:flutter_countdown_timer/current_remaining_time.dart';
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
2 years ago
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import '../../my_rich_text.dart';
class DoctorCard extends StatelessWidget {
2 years ago
final String? name;
final String? subName;
final double? rating;
final DateTime? date;
final String? profileUrl;
final String? billNo;
final VoidCallback? onTap;
final VoidCallback? onEmailTap;
final bool? isInOutPatient;
final bool? isShowInOutPatient;
final bool? isLiveCareAppointment;
final bool? isSortByClinic;
final String? appointmentTime;
final bool? isParentAppointment;
final int? remainingTimeInMinutes;
final String vaccineName;
final bool isSickLeave;
final int sickLeaveStatus;
final int projectID;
DoctorCard(
5 years ago
{this.name,
this.subName,
this.rating,
this.date,
this.profileUrl,
this.isSortByClinic = true,
this.billNo,
this.onTap,
this.onEmailTap,
this.isInOutPatient,
this.isLiveCareAppointment = false,
this.appointmentTime,
this.remainingTimeInMinutes,
this.isShowInOutPatient = true,
this.vaccineName = "",
this.isParentAppointment = false,
this.isSickLeave = false,
this.sickLeaveStatus = 0,
this.projectID = 0});
Merge branch 'development_v3.3' into dev_v3.13.6 # Conflicts: # lib/config/config.dart # lib/core/model/labs/patient_lab_orders.dart # lib/core/model/labs/request_patient_lab_special_result.dart # lib/core/model/labs/request_send_lab_report_email.dart # lib/core/model/privilege/VidaPlusProjectListModel.dart # lib/core/model/radiology/final_radiology.dart # lib/core/model/radiology/request_send_rad_report_email.dart # lib/core/service/client/base_app_client.dart # lib/core/service/medical/labs_service.dart # lib/core/service/medical/radiology_service.dart # lib/core/service/privilege_service.dart # lib/core/viewModels/medical/labs_view_model.dart # lib/core/viewModels/medical/radiology_view_model.dart # lib/core/viewModels/project_view_model.dart # lib/models/anicllary-orders/ancillary_order_list_model.dart # lib/models/anicllary-orders/ancillary_orders_proc_list.dart # lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart # lib/pages/Blood/confirm_payment_page.dart # lib/pages/BookAppointment/BookConfirm.dart # lib/pages/BookAppointment/BookSuccess.dart # lib/pages/BookAppointment/QRCode.dart # lib/pages/Covid-DriveThru/covid-payment-summary.dart # lib/pages/MyAppointments/MyAppointments.dart # lib/pages/MyAppointments/widgets/AppointmentActions.dart # lib/pages/ToDoList/ToDo.dart # lib/pages/feedback/send_feedback_page.dart # lib/pages/insurance/insurance_update_screen.dart # lib/pages/login/login.dart # lib/pages/medical/ask_doctor/doctor_response.dart # lib/pages/medical/balance/confirm_payment_page.dart # lib/pages/medical/balance/my_balance_page.dart # lib/pages/medical/labs/laboratory_result_page.dart # lib/pages/medical/radiology/radiology_details_page.dart # lib/pages/medical/radiology/radiology_home_page.dart # lib/pages/paymentService/payment_service.dart # lib/splashPage.dart # lib/uitl/utils.dart # lib/widgets/bottom_navigation/bottom_navigation_item.dart # lib/widgets/data_display/medical/LabResult/FlowChartPage.dart # lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart # lib/widgets/data_display/medical/doctor_card.dart # lib/widgets/data_display/medical/medical_profile_item.dart # pubspec.yaml
2 years ago
late ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return Container(
height: 135,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(width: 1, color: Color(0xffEFEFEF)),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white),
child: InkWell(
onTap: onTap,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
// width: 16, // projectViewModel.isArabic ? 27 : 20,
height: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.only(left: 2, right: 2),
2 years ago
decoration: isShowInOutPatient!
? BoxDecoration(
//Colors.red[900] Color(0xff404545)
2 years ago
color: Utils.isHMCProject(projectViewModel, projectID)
? Color(0xff3FACC8)
2 years ago
: isLiveCareAppointment != null && isLiveCareAppointment == true
? Color(0xff2E303A)
2 years ago
: isInOutPatient != null && isInOutPatient == false
? Color(0xffD02127)
: Color(0xffa9a089),
borderRadius: BorderRadius.only(
2 years ago
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),
),
)
: BoxDecoration(),
2 years ago
child: isShowInOutPatient!
5 years ago
? RotatedBox(
quarterTurns: 3,
child: Text(
2 years ago
isLiveCareAppointment != null && isLiveCareAppointment == true
5 years ago
? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach
2 years ago
: isInOutPatient != null && isInOutPatient == false
5 years ago
? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach
: TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10),
),
)
: Container(),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 20, right: 12, top: 12, bottom: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
if (isSickLeave)
Text(
getStatusText(context),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: getStatusColor(), letterSpacing: -0.4, height: 16 / 10),
),
Row(
mainAxisSize: MainAxisSize.min,
5 years ago
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
(name ?? ""),
5 years ago
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.64,
),
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
2 years ago
DateUtil.getDayMonthYearDateFormatted(date!),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
),
Text(
5 years ago
// DateUtil.formatDateToTime(date),
appointmentTime ?? "",
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48, height: 18 / 12),
),
],
),
],
),
Row(
mainAxisSize: MainAxisSize.min,
5 years ago
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
LargeAvatar(
name: name,
url: profileUrl,
width: 48,
height: 48,
),
SizedBox(width: 11),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
2 years ago
MyRichText(isSortByClinic! ? TranslationBase.of(context).branch : TranslationBase.of(context).clinic + ":", subName ?? "", projectViewModel!.isArabic),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
2 years ago
if (rating == null && billNo != "") MyRichText(TranslationBase.of(context).orderNo, billNo ?? "", projectViewModel!.isArabic),
2 years ago
if (vaccineName != "") MyRichText("", vaccineName ?? "", projectViewModel!.isArabic),
if (rating != null)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
2 years ago
// RatingBar.readOnly(
// initialRating: rating,
// size: 16.0,
// filledColor: Color(0XFFD02127),
// emptyColor: Color(0XFFD02127),
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star_border,
// ),
RatingBar(
2 years ago
itemSize: 20.0,
allowHalfRating: true,
2 years ago
initialRating: rating!,
2 years ago
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(
Icons.star,
color: CustomColors.accentColor,
),
half: Icon(
Icons.star_half,
2 years ago
color: CustomColors.accentColor,
),
empty: Icon(
Icons.star_border,
color: CustomColors.accentColor,
),
),
unratedColor: Colors.grey[500],
onRatingUpdate: (double value) {}),
],
5 years ago
),
if (remainingTimeInMinutes != null)
CountdownTimer(
2 years ago
controller: CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (remainingTimeInMinutes! * 1000) * 60),
widgetBuilder: (_, CurrentRemainingTime? time) {
return time != null
? Text(
"${time.days ?? 0}:${time.hours ?? 0}:${time.min}:${time.sec}",
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12),
)
: Container();
},
),
],
),
],
),
),
5 years ago
SizedBox(
height: 48,
child: Align(
alignment: Alignment.bottomCenter,
2 years ago
child: (onEmailTap != null && projectViewModel!.havePrivilege(17))
5 years ago
? InkWell(
onTap: onEmailTap,
child: Icon(
Icons.email,
3 years ago
color: sickLeaveStatus != 3 ? Theme.of(context).primaryColor : Colors.grey[400],
5 years ago
),
)
: onTap != null
? Icon(
Icons.arrow_forward,
color: Theme.of(context).primaryColor,
)
: SizedBox(),
),
5 years ago
),
],
),
],
),
),
)
],
),
),
);
}
String getStatusText(BuildContext context) {
String statusText = "";
if (sickLeaveStatus == 1) {
statusText = TranslationBase.of(context).pendingActivation;
} else if (sickLeaveStatus == 2) {
statusText = TranslationBase.of(context).ready;
} else if (sickLeaveStatus == 3) {
statusText = TranslationBase.of(context).awaitingApproval;
} else {
statusText = "";
}
return statusText;
}
Color getStatusColor() {
Color statusColor = Colors.white;
if (sickLeaveStatus == 1) {
statusColor = Color(0xffCC9B14);
} else if (sickLeaveStatus == 2) {
statusColor = Color(0xff359846);
} else if (sickLeaveStatus == 3) {
statusColor = Color(0xffD02127);
} else {
statusColor = Colors.white;
}
return statusColor;
}
}