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.
		
		
		
		
		
			
		
			
				
	
	
		
			336 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			336 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			Dart
		
	
import 'package:doctor_app_flutter/config/size_config.dart';
 | 
						|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.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:flutter/cupertino.dart';
 | 
						|
import 'package:flutter/material.dart';
 | 
						|
import 'package:provider/provider.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) {
 | 
						|
    ProjectViewModel projectViewModel = Provider.of(context);
 | 
						|
 | 
						|
    return Container(
 | 
						|
      margin: EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0),
 | 
						|
      child: Column(
 | 
						|
        children: [
 | 
						|
          Container(
 | 
						|
            child: CardWithBgWidget(
 | 
						|
              bgColor: referralStatusCode == 1
 | 
						|
                  ? Color(0xffc4aa54)
 | 
						|
                  : referralStatusCode == 2
 | 
						|
                      ? Colors.green[700]
 | 
						|
                      : referralStatusCode == 46
 | 
						|
                          ? Colors.green[900]
 | 
						|
                          : 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: 1.9 * SizeConfig.textMultiplier,
 | 
						|
                          fontWeight: FontWeight.w700,
 | 
						|
                          color: referralStatusCode == 1
 | 
						|
                              ? Color(0xffc4aa54)
 | 
						|
                              : referralStatusCode == 2
 | 
						|
                                  ? Colors.green[700]
 | 
						|
                                  : referralStatusCode == 46
 | 
						|
                                      ? Colors.green[900]
 | 
						|
                                      : referralStatusCode == 4
 | 
						|
                                          ? Colors.red[700]
 | 
						|
                                          : Colors.red[900],
 | 
						|
                        ),
 | 
						|
                        AppText(
 | 
						|
                          referredDate,
 | 
						|
                          fontFamily: 'Poppins',
 | 
						|
                          fontWeight: FontWeight.w600,
 | 
						|
                          fontSize: 2.0 * SizeConfig.textMultiplier,
 | 
						|
                          color: Color(0XFF28353E),
 | 
						|
                        )
 | 
						|
                      ],
 | 
						|
                    ),
 | 
						|
                    Row(
 | 
						|
                      crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                      children: [
 | 
						|
                        Expanded(
 | 
						|
                          child: AppText(
 | 
						|
                            patientName,
 | 
						|
                            fontSize: SizeConfig.textMultiplier * 2.2,
 | 
						|
                            fontWeight: FontWeight.bold,
 | 
						|
                            color: Colors.black,
 | 
						|
                            fontFamily: 'Poppins',
 | 
						|
                          ),
 | 
						|
                        ),
 | 
						|
                        SizedBox(
 | 
						|
                          width: 4,
 | 
						|
                        ),
 | 
						|
                        patientGender == 1
 | 
						|
                            ? Icon(
 | 
						|
                                DoctorApp.male_2,
 | 
						|
                                color: Colors.blue,
 | 
						|
                              )
 | 
						|
                            : Icon(
 | 
						|
                                DoctorApp.female_1,
 | 
						|
                                color: Colors.pink,
 | 
						|
                              ),
 | 
						|
                        SizedBox(
 | 
						|
                          width: 4,
 | 
						|
                        ),
 | 
						|
                        AppText(
 | 
						|
                          referredTime,
 | 
						|
                          fontFamily: 'Poppins',
 | 
						|
                          fontWeight: FontWeight.w600,
 | 
						|
                          fontSize: 1.8 * SizeConfig.textMultiplier,
 | 
						|
                          color: Color(0XFF575757),
 | 
						|
                        )
 | 
						|
                      ],
 | 
						|
                    ),
 | 
						|
                    Row(
 | 
						|
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
 | 
						|
                      crossAxisAlignment: CrossAxisAlignment.center,
 | 
						|
                      children: [
 | 
						|
                        Expanded(
 | 
						|
                          child: Column(
 | 
						|
                            children: [
 | 
						|
                              Row(
 | 
						|
                                mainAxisAlignment: MainAxisAlignment.start,
 | 
						|
                                children: [
 | 
						|
                                  AppText(
 | 
						|
                                    TranslationBase.of(context).fileNumber,
 | 
						|
                                    fontFamily: 'Poppins',
 | 
						|
                                    fontWeight: FontWeight.w600,
 | 
						|
                                    fontSize: 1.7 * SizeConfig.textMultiplier,
 | 
						|
                                    color: Color(0XFF575757),
 | 
						|
                                  ),
 | 
						|
                                  AppText(
 | 
						|
                                    patientID,
 | 
						|
                                    fontFamily: 'Poppins',
 | 
						|
                                    fontWeight: FontWeight.w700,
 | 
						|
                                    fontSize: 1.6 * SizeConfig.textMultiplier,
 | 
						|
                                    color: Color(0XFF2E303A),
 | 
						|
                                  ),
 | 
						|
                                ],
 | 
						|
                              ),
 | 
						|
                              Row(
 | 
						|
                                mainAxisAlignment: MainAxisAlignment.start,
 | 
						|
                                crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                                children: [
 | 
						|
                                  AppText(
 | 
						|
                                    isSameBranch
 | 
						|
                                        ? TranslationBase.of(context)
 | 
						|
                                            .referredFrom
 | 
						|
                                        : TranslationBase.of(context).refClinic,
 | 
						|
                                    fontFamily: 'Poppins',
 | 
						|
                                    fontWeight: FontWeight.w600,
 | 
						|
                                    fontSize: 1.7 * SizeConfig.textMultiplier,
 | 
						|
                                    color: Color(0XFF575757),
 | 
						|
                                  ),
 | 
						|
                                  Expanded(
 | 
						|
                                    child: AppText(
 | 
						|
                                      !isReferralClinic
 | 
						|
                                          ? isSameBranch
 | 
						|
                                              ? TranslationBase.of(context)
 | 
						|
                                                  .sameBranch
 | 
						|
                                              : TranslationBase.of(context)
 | 
						|
                                                  .otherBranch
 | 
						|
                                          : " " + referralClinic,
 | 
						|
                                      fontFamily: 'Poppins',
 | 
						|
                                      fontWeight: FontWeight.w700,
 | 
						|
                                      fontSize: 1.6 * SizeConfig.textMultiplier,
 | 
						|
                                      color: Color(0XFF2E303A),
 | 
						|
                                    ),
 | 
						|
                                  ),
 | 
						|
                                ],
 | 
						|
                              ),
 | 
						|
                            ],
 | 
						|
                          ),
 | 
						|
                        ),
 | 
						|
                        Row(
 | 
						|
                          children: [
 | 
						|
                            AppText(
 | 
						|
                              nationality != null ? nationality : "",
 | 
						|
                              fontWeight: FontWeight.bold,
 | 
						|
                              color: Color(0xFF2E303A),
 | 
						|
                              fontSize: 1.4 * SizeConfig.textMultiplier,
 | 
						|
                            ),
 | 
						|
                            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()
 | 
						|
                          ],
 | 
						|
                        )
 | 
						|
                      ],
 | 
						|
                    ),
 | 
						|
                    Row(
 | 
						|
                      mainAxisAlignment: MainAxisAlignment.start,
 | 
						|
                      crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                      children: [
 | 
						|
                        AppText(
 | 
						|
                          TranslationBase.of(context).remarks + " : ",
 | 
						|
                          fontFamily: 'Poppins',
 | 
						|
                          fontWeight: FontWeight.w600,
 | 
						|
                          fontSize: 1.7 * SizeConfig.textMultiplier,
 | 
						|
                          color: Color(0XFF575757),
 | 
						|
                        ),
 | 
						|
                        Expanded(
 | 
						|
                          child: AppText(
 | 
						|
                            remark ?? "",
 | 
						|
                            fontFamily: 'Poppins',
 | 
						|
                            fontWeight: FontWeight.w700,
 | 
						|
                            fontSize: 1.6 * SizeConfig.textMultiplier,
 | 
						|
                            color: Color(0XFF2E303A),
 | 
						|
                            maxLines: 1,
 | 
						|
                          ),
 | 
						|
                        ),
 | 
						|
                      ],
 | 
						|
                    ),
 | 
						|
                    Row(
 | 
						|
                      crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                      children: [
 | 
						|
                        Container(
 | 
						|
                          margin: EdgeInsets.only(left: 10, right: 0),
 | 
						|
                          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: 25, right: 0, bottom: 0),
 | 
						|
                          padding: EdgeInsets.only(left: 4.0, right: 4.0),
 | 
						|
                          child: Container(
 | 
						|
                            width: 40,
 | 
						|
                            height: 40,
 | 
						|
                            child: doctorAvatar != null
 | 
						|
                                ? ClipRRect(
 | 
						|
                                    borderRadius: BorderRadius.circular(20.0),
 | 
						|
                                    child: Image.network(
 | 
						|
                                      doctorAvatar,
 | 
						|
                                      height: 25,
 | 
						|
                                      width: 30,
 | 
						|
                                      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: 25, right: 10, bottom: 0),
 | 
						|
                            child: Column(
 | 
						|
                              crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                              children: [
 | 
						|
                                AppText(
 | 
						|
                                  referralDoctorName,
 | 
						|
                                  fontFamily: 'Poppins',
 | 
						|
                                  fontWeight: FontWeight.w800,
 | 
						|
                                  fontSize: 1.7 * SizeConfig.textMultiplier,
 | 
						|
                                  color: Colors.black,
 | 
						|
                                ),
 | 
						|
                                if (clinicDescription != null)
 | 
						|
                                  AppText(
 | 
						|
                                    clinicDescription,
 | 
						|
                                    fontFamily: 'Poppins',
 | 
						|
                                    fontWeight: FontWeight.w700,
 | 
						|
                                    fontSize: 1.4 * SizeConfig.textMultiplier,
 | 
						|
                                    color: Color(0XFF2E303A),
 | 
						|
                                  ),
 | 
						|
                              ],
 | 
						|
                            ),
 | 
						|
                          ),
 | 
						|
                        ),
 | 
						|
                      ],
 | 
						|
                    ),
 | 
						|
                    Container(
 | 
						|
                        width: double.infinity,
 | 
						|
                        alignment: Alignment.centerRight,
 | 
						|
                        child: infoIcon ?? Container())
 | 
						|
                  ],
 | 
						|
                ),
 | 
						|
                // onTap: onTap,
 | 
						|
              )),
 | 
						|
            ),
 | 
						|
          ),
 | 
						|
        ],
 | 
						|
      ),
 | 
						|
    );
 | 
						|
  }
 | 
						|
}
 |