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.
doctor_app_flutter/lib/widgets/patients/patient-referral-item-widge...

293 lines
12 KiB
Dart

import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:flutter/material.dart';
import '../../util/helpers.dart';
class PatientReferralItemWidget extends StatelessWidget {
final String referralStatus;
final int referralStatusCode;
final String patientName;
final int patientGender;
final String referredDate;
final String referredTime;
final String patientID;
final isSameBranch;
final bool isReferral;
final bool isReferralClinic;
final String referralClinic;
final String remark;
final String nationality;
final String nationalityFlag;
final String doctorAvatar;
final String referralDoctorName;
final String clinicDescription;
final Widget infoIcon;
PatientReferralItemWidget(
{this.referralStatus,
this.referralStatusCode,
this.patientName,
this.patientGender,
this.referredDate,
this.referredTime,
this.patientID,
this.isSameBranch,
this.isReferral,
this.remark,
this.nationality,
this.nationalityFlag,
this.doctorAvatar,
this.referralDoctorName,
this.clinicDescription,
this.infoIcon,
this.isReferralClinic = false,
this.referralClinic});
@override
Widget build(BuildContext context) {
return Container(
4 years ago
margin: EdgeInsets.only(left: 16.0, right: 16.0, top: 0.0),
child: Column(
children: [
Container(
child: CardWithBgWidget(
bgColor: referralStatusCode == 1
4 years ago
? AppGlobal.inProgressColor
//Color(0xffc4aa54)
4 years ago
: referralStatusCode == 2
? AppGlobal.appGreenColor
4 years ago
: referralStatusCode == 46
? AppGlobal.appGreenColor
4 years ago
: referralStatusCode == 4
? Colors.red[700]
: Colors.red[900],
hasBorder: false,
widget: Container(
// padding: EdgeInsets.only(left: 20, right: 0, bottom: 0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(
referralStatus != null ? referralStatus : "",
fontFamily: 'Poppins',
fontSize: 12.0,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
color: referralStatusCode == 1
4 years ago
? AppGlobal.inProgressColor
4 years ago
: referralStatusCode == 2
? AppGlobal.appGreenColor
4 years ago
: referralStatusCode == 46
? AppGlobal.appGreenColor
4 years ago
: referralStatusCode == 4
? Colors.red[700]
: Colors.red[900],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
referredDate ?? "",
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
fontSize: 12.0,
color: Color(0XFF28353E),
),
AppText(
referredTime ?? "",
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 12.0,
color: Color(0XFF575757),
letterSpacing: -0.48,
),
],
)
],
),
SizedBox(
height: 7,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
4 years ago
AppText(
4 years ago
Helpers.convertToTitleCase(patientName ?? ""),
4 years ago
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
fontFamily: 'Poppins',
letterSpacing: -0.64,
),
SizedBox(
width: 0,
),
patientGender == 1
? Icon(
DoctorApp.male_2,
color: Colors.blue,
)
: Icon(DoctorApp.female_1,
color: Color(0xffF0448D)),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
children: [
4 years ago
CustomRow(
4 years ago
label: TranslationBase.of(context).fileNumber,
4 years ago
value: patientID,
),
4 years ago
CustomRow(
label: isSameBranch
4 years ago
? TranslationBase.of(context).referredFrom
4 years ago
: TranslationBase.of(context).refClinic,
value: !isReferralClinic
? isSameBranch
4 years ago
? TranslationBase.of(context).sameBranch
4 years ago
: TranslationBase.of(context)
.otherBranch
: " " + Helpers.convertToTitleCase(referralClinic ?? ""),
),
],
),
),
Padding(
padding: const EdgeInsets.only(right: 0.1),
child: Row(
children: [
AppText(
nationality != null ? nationality : "",
fontWeight: FontWeight.w600,
color: Color(0xFF2E303A),
fontSize: 10.0,
letterSpacing: -0.4,
),
nationalityFlag != null
? ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
nationalityFlag,
height: 25,
width: 30,
errorBuilder: (BuildContext context,
Object exception,
StackTrace stackTrace) {
return Text('');
},
)
)
: SizedBox()
],
),
)
],
),
4 years ago
CustomRow(
label: TranslationBase.of(context).remarks + " : ",
value: remark ?? "",
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(left: 3, right: 0, top: 0.1),
child: Image.asset(
isReferral
? 'assets/images/patient/ic_ref_arrow_up.png'
: 'assets/images/patient/ic_ref_arrow_left.png',
height: 50,
width: 30,
),
),
Container(
margin: EdgeInsets.only(
left: 0, top: 18, right: 0, bottom: 0),
padding: EdgeInsets.only(left: 4.0, right: 1.0),
child: Container(
width: 40,
height: 40,
child: doctorAvatar != null
? ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
doctorAvatar,
height: 28,
width: 28,
errorBuilder: (BuildContext context,
Object exception,
StackTrace stackTrace) {
return Text('No Image');
},
))
: Container(
child: Image.asset(
patientGender == 1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover,
),
),
),
),
Expanded(
flex: 4,
child: Container(
margin: EdgeInsets.only(
left: 10, top: 17, bottom: 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
Helpers.convertToTitleCase(referralDoctorName ?? ""),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 14.0,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
if (clinicDescription != null)
AppText(
Helpers.convertToTitleCase(clinicDescription ?? "")
,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 10.0,
color: Color(0xff575757),
letterSpacing: -0.4,
),
],
),
),
),
],
),
Container(
width: double.infinity,
alignment: Alignment.centerRight,
child: infoIcon ?? Container())
],
),
// onTap: onTap,
)),
),
),
],
),
);
}
}