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.
219 lines
9.1 KiB
Dart
219 lines
9.1 KiB
Dart
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:hmg_nurses/classes/date-utils.dart';
|
|
import 'package:hmg_nurses/classes/utils.dart';
|
|
import 'package:hmg_nurses/extensions/int_extensions.dart';
|
|
import 'package:hmg_nurses/extensions/string_extensions.dart';
|
|
import 'package:hmg_nurses/main.dart';
|
|
import 'package:hmg_nurses/widgets/commen/cusom_row.dart';
|
|
import 'package:sizer/sizer.dart';
|
|
|
|
import '../../../widgets/circular_avatar.dart';
|
|
|
|
class PatientCard extends StatelessWidget {
|
|
final String name;
|
|
final int gender;
|
|
final String nationalityName;
|
|
final String nationalityFlagURL;
|
|
final String fileNumber;
|
|
final String dateofBirth;
|
|
final String? arrivedOn;
|
|
final String? appointmentDate;
|
|
final String? admissionDate;
|
|
final String? clinicDescription;
|
|
final String? roomId;
|
|
final GestureTapCallback? onTap;
|
|
|
|
const PatientCard({
|
|
super.key,
|
|
required this.name,
|
|
required this.gender,
|
|
required this.nationalityName,
|
|
required this.nationalityFlagURL,
|
|
required this.fileNumber,
|
|
required this.dateofBirth,
|
|
this.arrivedOn,
|
|
this.appointmentDate,
|
|
this.admissionDate,
|
|
this.clinicDescription,
|
|
this.roomId,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: 120,
|
|
decoration: BoxDecoration(
|
|
borderRadius: const BorderRadius.all(
|
|
Radius.circular(10.0),
|
|
),
|
|
border: Border.all(width: 1, color: const Color(0xffEFEFEF)),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0xff000000).withOpacity(.05),
|
|
//spreadRadius: 5,
|
|
blurRadius: 27,
|
|
offset: const Offset(0, -3),
|
|
),
|
|
],
|
|
color: Colors.white,
|
|
),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
height: double.infinity,
|
|
alignment: Alignment.center,
|
|
padding: const EdgeInsets.only(left: 2, right: 2),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xffD02127),
|
|
// isFromLiveCare
|
|
// ? Colors.white
|
|
// : (isMyPatient && !isFromSearch)
|
|
// ? AppGlobal.appGreenColor
|
|
// : patientInfo.patientStatusType == 43
|
|
// ? AppGlobal.appGreenColor
|
|
// : isMyPatient
|
|
// ? AppGlobal.appGreenColor
|
|
// : isInpatient
|
|
// ? Colors.white
|
|
// : !isFromSearch
|
|
// ? Colors.red[800]
|
|
// : Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: appState.isArabic() ? const Radius.circular(0) : const Radius.circular(10),
|
|
bottomLeft: appState.isArabic() ? const Radius.circular(0) : const Radius.circular(10),
|
|
topRight: appState.isArabic() ? const Radius.circular(10) : const Radius.circular(0),
|
|
bottomRight: appState.isArabic() ? const Radius.circular(10) : const Radius.circular(0),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
padding: const EdgeInsets.all(8),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Utils.capitalize(name).toText12(),
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
|
child: SvgPicture.asset(
|
|
gender == 1 ? "assets/images/svgs/male.svg" : "assets/images/svgs/female.svg",
|
|
),
|
|
)
|
|
// if (isFromLiveCare)
|
|
// ShowTimer(
|
|
// patientInfo: patientInfo,
|
|
// ),
|
|
],
|
|
),
|
|
if (nationalityName.isNotEmpty)
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
nationalityName.truncate(14).toTextAuto(
|
|
fontSize: 9,
|
|
color: const Color(0xFF2E303A),
|
|
textOverflow: TextOverflow.ellipsis,
|
|
),
|
|
nationalityFlagURL.isNotEmpty
|
|
? ClipRRect(
|
|
borderRadius: BorderRadius.circular(20.0),
|
|
child: CachedNetworkImage(
|
|
imageUrl: nationalityFlagURL ?? "",
|
|
height: 16,
|
|
width: 22,
|
|
errorWidget: (context, url, error) => "No Image".toText10(),
|
|
),
|
|
)
|
|
: const SizedBox()
|
|
],
|
|
),
|
|
],
|
|
),
|
|
12.height,
|
|
Row(
|
|
children: [
|
|
showGenderAvator(gender),
|
|
12.width,
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
CustomRow(
|
|
label: "File Number:",
|
|
value: fileNumber.toString(),
|
|
),
|
|
CustomRow(
|
|
label: "Age : ",
|
|
value: "${AppDateUtils.getAgeByBirthday(dateofBirth, context, isServerFormat: true)}",
|
|
),
|
|
arrivedOn != null
|
|
? CustomRow(
|
|
label: "Arrived On : ",
|
|
value: AppDateUtils.getDayMonthYearDateFormatted(
|
|
AppDateUtils.convertStringToDate(
|
|
arrivedOn!,
|
|
),
|
|
isMonthShort: true,
|
|
),
|
|
)
|
|
: (appointmentDate != null && appointmentDate!.isNotEmpty)
|
|
? Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
CustomRow(
|
|
label: "Appointment Date : ",
|
|
value: AppDateUtils.getDayMonthYearDateFormatted(
|
|
AppDateUtils.convertStringToDate(
|
|
appointmentDate!,
|
|
),
|
|
isMonthShort: true),
|
|
),
|
|
],
|
|
)
|
|
: const SizedBox(),
|
|
if (admissionDate != null)
|
|
CustomRow(
|
|
label: "Num Of Days : ",
|
|
value: "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(admissionDate!)).inDays + 1}",
|
|
),
|
|
if (admissionDate != null)
|
|
CustomRow(
|
|
label: "Clinic Name : ",
|
|
value: "$clinicDescription",
|
|
),
|
|
if (admissionDate != null)
|
|
CustomRow(
|
|
label: "Room No : ",
|
|
value: "$roomId",
|
|
),
|
|
],
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|