import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../../../../routes.dart'; import '../../../../widgets/shared/errors/error_message.dart'; class MyReferralPatientScreen extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getPendingReferralPatients(), builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, appBarTitle: TranslationBase.of(context).referPatient, body: model.pendingReferral == null || model.pendingReferral.length == 0 ? Center( child: Container( child: ErrorMessage( error: TranslationBase.of(context).referralEmptyMsg, ))) : SingleChildScrollView( child: Container( margin: EdgeInsets.only(top: 70), // color: Colors.white, // height: MediaQuery.of(context).size.height, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // SizedBox(height: 50), ...List.generate( model.pendingReferral.length, (index) => InkWell( onTap: () { Navigator.of(context).pushNamed(MY_REFERRAL_DETAIL, arguments: { 'referral': model.pendingReferral[index] }); }, child: PatientReferralItemWidget( referralStatus: model.pendingReferral[index].referralStatus, patientName: model.pendingReferral[index].patientName, patientGender: model .pendingReferral[index].patientDetails.gender, referredDate: model .pendingReferral[index].referredOn .split(" ")[0], referredTime: model .pendingReferral[index].referredOn .split(" ")[1], patientID: "${model.pendingReferral[index].patientID}", isSameBranch: model.pendingReferral[index] .isReferralDoctorSameBranch, isReferral: true, remark: model.pendingReferral[index].remarksFromSource, nationality: model.pendingReferral[index] .patientDetails.nationalityName, nationalityFlag: model.pendingReferral[index].nationalityFlagUrl, doctorAvatar: model.pendingReferral[index].doctorImageUrl, referralDoctorName: model .pendingReferral[index].referredByDoctorInfo, clinicDescription: null, infoIcon: InkWell( onTap: () { Navigator.of(context) .pushNamed(MY_REFERRAL_DETAIL, arguments: { 'referral': model.pendingReferral[index] }); }, child: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), ), ), ), ), ], ), ), ), ), ); } }