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.
		
		
		
		
		
			
		
			
				
	
	
		
			691 lines
		
	
	
		
			25 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			691 lines
		
	
	
		
			25 KiB
		
	
	
	
		
			Dart
		
	
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart';
 | 
						|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
 | 
						|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
 | 
						|
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/utils.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
 | 
						|
import 'package:flutter/cupertino.dart';
 | 
						|
import 'package:flutter/material.dart';
 | 
						|
 | 
						|
class ClinicList extends StatefulWidget {
 | 
						|
  final Function getLiveCareHistory;
 | 
						|
 | 
						|
  ClinicList({@required this.getLiveCareHistory});
 | 
						|
 | 
						|
  @override
 | 
						|
  _clinic_listState createState() => _clinic_listState();
 | 
						|
}
 | 
						|
 | 
						|
class _clinic_listState extends State<ClinicList> {
 | 
						|
  int currentSelectedIndex = 0;
 | 
						|
  LiveCareClinicsListResponse liveCareClinicsListResponse;
 | 
						|
 | 
						|
  LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse;
 | 
						|
 | 
						|
  bool isDataLoaded = false;
 | 
						|
  var languageID;
 | 
						|
  var currentSelectedLiveCareType;
 | 
						|
 | 
						|
  int selectedClinicID = 1;
 | 
						|
  String selectedClinicName = "-";
 | 
						|
 | 
						|
  AppSharedPreferences sharedPref = AppSharedPreferences();
 | 
						|
 | 
						|
  AuthenticatedUser authUser;
 | 
						|
  AuthProvider authProvider = new AuthProvider();
 | 
						|
 | 
						|
  MyInAppBrowser browser;
 | 
						|
 | 
						|
  @override
 | 
						|
  void initState() {
 | 
						|
    liveCareClinicsListResponse = new LiveCareClinicsListResponse();
 | 
						|
    liveCareScheduleClinicsListResponse =
 | 
						|
        new LiveCareScheduleClinicsListResponse();
 | 
						|
 | 
						|
    WidgetsBinding.instance.addPostFrameCallback((_) {
 | 
						|
      openLiveCareSelectionDialog();
 | 
						|
    });
 | 
						|
 | 
						|
    getLanguageID();
 | 
						|
    super.initState();
 | 
						|
  }
 | 
						|
 | 
						|
  @override
 | 
						|
  Widget build(BuildContext context) {
 | 
						|
    return SingleChildScrollView(
 | 
						|
        child: currentSelectedLiveCareType == "immediate"
 | 
						|
            ? getLiveCareImmediateClinicList()
 | 
						|
            : getLiveCareScheduleClinicList());
 | 
						|
  }
 | 
						|
 | 
						|
  void startLiveCare() {
 | 
						|
    bool isError = false;
 | 
						|
    LiveCareService service = new LiveCareService();
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    ERAppointmentFeesResponse erAppointmentFeesResponse =
 | 
						|
        new ERAppointmentFeesResponse();
 | 
						|
    service.getERAppointmentFees(selectedClinicID, context).then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      if (res['HasAppointment'] == true) {
 | 
						|
        isError = true;
 | 
						|
        showLiveCareCancelDialog(res['ErrorEndUserMessage'], res);
 | 
						|
      } else {
 | 
						|
        erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res);
 | 
						|
        isError = false;
 | 
						|
      }
 | 
						|
      if (!isError)
 | 
						|
        getERAppointmentTime(
 | 
						|
            erAppointmentFeesResponse.getERAppointmentFeesList);
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      print(err);
 | 
						|
      isError = true;
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  showLiveCareCancelDialog(String msg, res) {
 | 
						|
    ConfirmDialog dialog = new ConfirmDialog(
 | 
						|
        context: context,
 | 
						|
        confirmMessage: msg,
 | 
						|
        okText: TranslationBase.of(context).confirm,
 | 
						|
        cancelText: TranslationBase.of(context).cancel_nocaps,
 | 
						|
        okFunction: () => {cancelAppointment(res)},
 | 
						|
        cancelFunction: () => {});
 | 
						|
    dialog.showAlertDialog(context);
 | 
						|
  }
 | 
						|
 | 
						|
  cancelAppointment(res) {
 | 
						|
    AppoitmentAllHistoryResultList appo = AppoitmentAllHistoryResultList();
 | 
						|
    appo.clinicID = res['ClinicID'];
 | 
						|
    appo.doctorID = res['DoctorID'];
 | 
						|
    appo.endTime = res['EndTime'];
 | 
						|
    appo.projectID = res['ProjectID'];
 | 
						|
    appo.startTime = res['StrAppointmentDate'];
 | 
						|
    appo.appointmentNo = res['AppointmentID'];
 | 
						|
    appo.isLiveCareAppointment = true;
 | 
						|
    appo.originalClinicID = 0;
 | 
						|
    appo.originalProjectID = res['ProjectID'];
 | 
						|
    appo.appointmentDate = res['AppointmentDate'];
 | 
						|
 | 
						|
    ConfirmDialog.closeAlertDialog(context);
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    DoctorsListService service = new DoctorsListService();
 | 
						|
    service.cancelAppointment(appo, context).then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      print(res);
 | 
						|
      if (res['MessageStatus'] == 1) {
 | 
						|
        AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
 | 
						|
        startLiveCare();
 | 
						|
      } else {
 | 
						|
        AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
 | 
						|
      }
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
      print(err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) {
 | 
						|
    LiveCareService service = new LiveCareService();
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    service.getERAppointmentTime(selectedClinicID, context).then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      print(res);
 | 
						|
      showLiveCarePaymentDialog(
 | 
						|
          getERAppointmentFeesList, res['WatingtimeInteger']);
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      print(err);
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  showLiveCarePaymentDialog(
 | 
						|
      GetERAppointmentFeesList getERAppointmentFeesList, int waitingTime) {
 | 
						|
    showGeneralDialog(
 | 
						|
            barrierColor: Colors.black.withOpacity(0.5),
 | 
						|
            transitionBuilder: (context, a1, a2, widget) {
 | 
						|
              final curvedValue =
 | 
						|
                  Curves.easeInOutBack.transform(a1.value) - 1.0;
 | 
						|
              return Transform(
 | 
						|
                transform:
 | 
						|
                    Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
 | 
						|
                child: Opacity(
 | 
						|
                  opacity: a1.value,
 | 
						|
                  child: LiveCarePaymentDialog(
 | 
						|
                      getERAppointmentFeesList: getERAppointmentFeesList,
 | 
						|
                      waitingTime: waitingTime,
 | 
						|
                      clinicName: selectedClinicName),
 | 
						|
                ),
 | 
						|
              );
 | 
						|
            },
 | 
						|
            transitionDuration: Duration(milliseconds: 500),
 | 
						|
            barrierDismissible: true,
 | 
						|
            barrierLabel: '',
 | 
						|
            context: context,
 | 
						|
            pageBuilder: (context, animation1, animation2) {})
 | 
						|
        .then((value) {
 | 
						|
      if (value) {
 | 
						|
        if (getERAppointmentFeesList.total == "0" ||
 | 
						|
            getERAppointmentFeesList.total == "0.0") {
 | 
						|
          showLiveCareInfoDialog(getERAppointmentFeesList);
 | 
						|
        } else {
 | 
						|
          navigateToPaymentMethod(getERAppointmentFeesList, context);
 | 
						|
        }
 | 
						|
      }
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  showLiveCareInfoDialog(
 | 
						|
      GetERAppointmentFeesList getERAppointmentFeesList) async {
 | 
						|
    if (await this.sharedPref.getObject(USER_PROFILE) != null) {
 | 
						|
      var data = AuthenticatedUser.fromJson(
 | 
						|
          await this.sharedPref.getObject(USER_PROFILE));
 | 
						|
      setState(() {
 | 
						|
        authUser = data;
 | 
						|
      });
 | 
						|
    }
 | 
						|
 | 
						|
    showGeneralDialog(
 | 
						|
            barrierColor: Colors.black.withOpacity(0.5),
 | 
						|
            transitionBuilder: (context, a1, a2, widget) {
 | 
						|
              final curvedValue =
 | 
						|
                  Curves.easeInOutBack.transform(a1.value) - 1.0;
 | 
						|
              return Transform(
 | 
						|
                transform:
 | 
						|
                    Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
 | 
						|
                child: Opacity(
 | 
						|
                  opacity: a1.value,
 | 
						|
                  child: LiveCareInfoDialog(),
 | 
						|
                ),
 | 
						|
              );
 | 
						|
            },
 | 
						|
            transitionDuration: Duration(milliseconds: 500),
 | 
						|
            barrierDismissible: true,
 | 
						|
            barrierLabel: '',
 | 
						|
            context: context,
 | 
						|
            pageBuilder: (context, animation1, animation2) {})
 | 
						|
        .then((value) {
 | 
						|
      if (value) {
 | 
						|
        if (getERAppointmentFeesList.total == "0" ||
 | 
						|
            getERAppointmentFeesList.total == "0.0") {
 | 
						|
          addNewCallForPatientER(authUser.patientID.toString() +
 | 
						|
              "" +
 | 
						|
              DateTime.now().millisecondsSinceEpoch.toString());
 | 
						|
        } else {
 | 
						|
          navigateToPaymentMethod(getERAppointmentFeesList, context);
 | 
						|
        }
 | 
						|
      }
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  Future navigateToPaymentMethod(
 | 
						|
      GetERAppointmentFeesList getERAppointmentFeesList, context) async {
 | 
						|
    AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
 | 
						|
 | 
						|
    appo.clinicID = selectedClinicID;
 | 
						|
    appo.appointmentNo = DateTime.now().millisecondsSinceEpoch;
 | 
						|
 | 
						|
    if (await this.sharedPref.getObject(USER_PROFILE) != null) {
 | 
						|
      var data = AuthenticatedUser.fromJson(
 | 
						|
          await this.sharedPref.getObject(USER_PROFILE));
 | 
						|
      setState(() {
 | 
						|
        authUser = data;
 | 
						|
      });
 | 
						|
    }
 | 
						|
 | 
						|
    Navigator.push(
 | 
						|
            context, MaterialPageRoute(builder: (context) => PaymentMethod()))
 | 
						|
        .then((value) {
 | 
						|
      print(value);
 | 
						|
      if (value != null) {
 | 
						|
        openPayment(value, authUser,
 | 
						|
            double.parse(getERAppointmentFeesList.total), appo);
 | 
						|
      }
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  openPayment(String paymentMethod, AuthenticatedUser authenticatedUser,
 | 
						|
      double amount, AppoitmentAllHistoryResultList appo) {
 | 
						|
    browser = new MyInAppBrowser(
 | 
						|
        onExitCallback: onBrowserExit,
 | 
						|
        appo: appo,
 | 
						|
        onLoadStartCallback: onBrowserLoadStart);
 | 
						|
 | 
						|
    browser.openPaymentBrowser(
 | 
						|
        amount,
 | 
						|
        "LiveCare Payment",
 | 
						|
        Utils.getAppointmentTransID(12, appo.clinicID, appo.appointmentNo),
 | 
						|
        "12",
 | 
						|
        authenticatedUser.emailAddress,
 | 
						|
        paymentMethod,
 | 
						|
        authenticatedUser.patientType,
 | 
						|
        authenticatedUser.firstName,
 | 
						|
        authenticatedUser.patientID,
 | 
						|
        authenticatedUser,
 | 
						|
        browser,
 | 
						|
        false);
 | 
						|
  }
 | 
						|
 | 
						|
  onBrowserLoadStart(String url) {
 | 
						|
    print("onBrowserLoadStart");
 | 
						|
    print(url);
 | 
						|
 | 
						|
    MyInAppBrowser.successURLS.forEach((element) {
 | 
						|
      if (url.contains(element)) {
 | 
						|
        if (browser.isOpened()) browser.close();
 | 
						|
        MyInAppBrowser.isPaymentDone = true;
 | 
						|
        return;
 | 
						|
      }
 | 
						|
    });
 | 
						|
 | 
						|
    MyInAppBrowser.errorURLS.forEach((element) {
 | 
						|
      if (url.contains(element)) {
 | 
						|
        if (browser.isOpened()) browser.close();
 | 
						|
        MyInAppBrowser.isPaymentDone = false;
 | 
						|
        return;
 | 
						|
      }
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
 | 
						|
    print("onBrowserExit Called!!!!");
 | 
						|
    if (isPaymentMade) checkPaymentStatus(appo);
 | 
						|
  }
 | 
						|
 | 
						|
  checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
 | 
						|
    DoctorsListService service = new DoctorsListService();
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    service
 | 
						|
        .checkPaymentStatus(
 | 
						|
            Utils.getAppointmentTransID(
 | 
						|
                appo.projectID, appo.clinicID, appo.appointmentNo),
 | 
						|
            context)
 | 
						|
        .then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      print("Printing Payment Status Reponse!!!!");
 | 
						|
      print(res);
 | 
						|
      String paymentInfo = res['Response_Message'];
 | 
						|
      if (paymentInfo == 'Success') {
 | 
						|
        addNewCallForPatientER(Utils.getAppointmentTransID(
 | 
						|
            appo.projectID, appo.clinicID, appo.appointmentNo));
 | 
						|
      } else {
 | 
						|
        AppToast.showErrorToast(message: res['Response_Message']);
 | 
						|
      }
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
      print(err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  addNewCallForPatientER(String clientRequestID) {
 | 
						|
    LiveCareService service = new LiveCareService();
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    service
 | 
						|
        .addNewCallForPatientER(selectedClinicID, clientRequestID, context)
 | 
						|
        .then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      AppToast.showSuccessToast(
 | 
						|
          message: "New Call has been added successfully");
 | 
						|
      widget.getLiveCareHistory();
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
      print(err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  getLanguageID() async {
 | 
						|
    languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
 | 
						|
  }
 | 
						|
 | 
						|
  getLiveCareClinicsList() {
 | 
						|
    isDataLoaded = false;
 | 
						|
    LiveCareService service = new LiveCareService();
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    service.getLivecareClinics(context).then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      print(res['PatientER_GetClinicsList'].length);
 | 
						|
      if (res['MessageStatus'] == 1) {
 | 
						|
        setState(() {
 | 
						|
          liveCareClinicsListResponse =
 | 
						|
              LiveCareClinicsListResponse.fromJson(res);
 | 
						|
          print(liveCareClinicsListResponse.patientERGetClinicsList.length);
 | 
						|
          selectedClinicID =
 | 
						|
              liveCareClinicsListResponse.patientERGetClinicsList[0].serviceID;
 | 
						|
          selectedClinicName = liveCareClinicsListResponse
 | 
						|
              .patientERGetClinicsList[0].serviceName;
 | 
						|
          isDataLoaded = true;
 | 
						|
        });
 | 
						|
      } else {
 | 
						|
        isDataLoaded = true;
 | 
						|
        AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
 | 
						|
      }
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
      print(err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  getLiveCareScheduleClinicsList() {
 | 
						|
    isDataLoaded = false;
 | 
						|
    LiveCareService service = new LiveCareService();
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    service.getLiveCareScheduledClinics(context).then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      print(res['ClinicsHaveScheduleList'].length);
 | 
						|
      if (res['MessageStatus'] == 1) {
 | 
						|
        setState(() {
 | 
						|
          liveCareScheduleClinicsListResponse =
 | 
						|
              LiveCareScheduleClinicsListResponse.fromJson(res);
 | 
						|
          print(liveCareScheduleClinicsListResponse
 | 
						|
              .clinicsHaveScheduleList.length);
 | 
						|
          selectedClinicID = liveCareScheduleClinicsListResponse
 | 
						|
              .clinicsHaveScheduleList[0].serviceID;
 | 
						|
          selectedClinicName = liveCareScheduleClinicsListResponse
 | 
						|
              .clinicsHaveScheduleList[0].clinicDesc;
 | 
						|
          isDataLoaded = true;
 | 
						|
        });
 | 
						|
      } else {
 | 
						|
        isDataLoaded = true;
 | 
						|
        AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
 | 
						|
      }
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
      print(err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  openLiveCareSelectionDialog() {
 | 
						|
    Navigator.of(context)
 | 
						|
        .push(new MaterialPageRoute<String>(
 | 
						|
            builder: (BuildContext context) {
 | 
						|
              return LiveCareTypeSelect();
 | 
						|
            },
 | 
						|
            fullscreenDialog: true))
 | 
						|
        .then((value) {
 | 
						|
      if (value == null) {
 | 
						|
        Navigator.pop(context);
 | 
						|
      } else {
 | 
						|
        print(value);
 | 
						|
        if (value == "immediate") {
 | 
						|
          setState(() {
 | 
						|
            currentSelectedLiveCareType = "immediate";
 | 
						|
          });
 | 
						|
          getLiveCareClinicsList();
 | 
						|
        }
 | 
						|
        if (value == "schedule") {
 | 
						|
          setState(() {
 | 
						|
            currentSelectedLiveCareType = "schedule";
 | 
						|
          });
 | 
						|
          getLiveCareScheduleClinicsList();
 | 
						|
        }
 | 
						|
      }
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  Widget getLiveCareScheduleClinicList() {
 | 
						|
    return Column(
 | 
						|
      children: <Widget>[
 | 
						|
        isDataLoaded
 | 
						|
            ? Container(
 | 
						|
                height: MediaQuery.of(context).size.height * 0.7,
 | 
						|
                child: Column(
 | 
						|
                  crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                  children: <Widget>[
 | 
						|
//                    Container(
 | 
						|
//                      margin: EdgeInsets.all(15.0),
 | 
						|
//                      child: Text("Online Clinics: ",
 | 
						|
//                          style: TextStyle(
 | 
						|
//                              fontSize: 20.0, fontWeight: FontWeight.bold)),
 | 
						|
//                    ),
 | 
						|
                    ListView.builder(
 | 
						|
                      scrollDirection: Axis.vertical,
 | 
						|
                      shrinkWrap: true,
 | 
						|
                      physics: ScrollPhysics(),
 | 
						|
                      padding: EdgeInsets.all(0.0),
 | 
						|
                      itemCount: liveCareScheduleClinicsListResponse
 | 
						|
                          .clinicsHaveScheduleList.length,
 | 
						|
                      itemBuilder: (context, index) {
 | 
						|
                        return InkWell(
 | 
						|
                          onTap: () {
 | 
						|
                            updateSelectedScheduleIndex(
 | 
						|
                                liveCareScheduleClinicsListResponse
 | 
						|
                                    .clinicsHaveScheduleList[index]);
 | 
						|
                          },
 | 
						|
                          child: ScheduleClinicCard(
 | 
						|
                            isSelected: selectedClinicID ==
 | 
						|
                                    liveCareScheduleClinicsListResponse
 | 
						|
                                        .clinicsHaveScheduleList[index]
 | 
						|
                                        .serviceID
 | 
						|
                                ? true
 | 
						|
                                : false,
 | 
						|
                            clinicsHaveScheduleList:
 | 
						|
                                liveCareScheduleClinicsListResponse
 | 
						|
                                    .clinicsHaveScheduleList[index],
 | 
						|
                            languageID: languageID,
 | 
						|
                          ),
 | 
						|
                        );
 | 
						|
                      },
 | 
						|
                    ),
 | 
						|
                    Container(
 | 
						|
                      height: 10.0,
 | 
						|
                    ),
 | 
						|
                  ],
 | 
						|
                ),
 | 
						|
              )
 | 
						|
            : Container(),
 | 
						|
        isDataLoaded
 | 
						|
            ? Align(
 | 
						|
                alignment: FractionalOffset.bottomCenter,
 | 
						|
                child: Container(
 | 
						|
                  width: MediaQuery.of(context).size.width,
 | 
						|
                  height: 50.0,
 | 
						|
                  margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
 | 
						|
                  child: ButtonTheme(
 | 
						|
                    shape: RoundedRectangleBorder(
 | 
						|
                      borderRadius: BorderRadius.circular(10.0),
 | 
						|
                    ),
 | 
						|
                    minWidth: MediaQuery.of(context).size.width * 0.7,
 | 
						|
                    height: 45.0,
 | 
						|
                    child: RaisedButton(
 | 
						|
                      color: new Color(0xFF60686b),
 | 
						|
                      textColor: Colors.white,
 | 
						|
                      disabledTextColor: Colors.white,
 | 
						|
                      disabledColor: new Color(0xFFbcc2c4),
 | 
						|
                      onPressed: startScheduleLiveCare,
 | 
						|
                      child: Text("Start", style: TextStyle(fontSize: 18.0)),
 | 
						|
                    ),
 | 
						|
                  ),
 | 
						|
                ),
 | 
						|
              )
 | 
						|
            : Container(),
 | 
						|
      ],
 | 
						|
    );
 | 
						|
  }
 | 
						|
 | 
						|
  Widget getLiveCareImmediateClinicList() {
 | 
						|
    return Column(
 | 
						|
      children: <Widget>[
 | 
						|
        isDataLoaded
 | 
						|
            ? Container(
 | 
						|
                height: MediaQuery.of(context).size.height * 0.7,
 | 
						|
                child: Column(
 | 
						|
                  crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                  children: <Widget>[
 | 
						|
                    Container(
 | 
						|
                      margin: EdgeInsets.all(15.0),
 | 
						|
                      child: Text("Online Clinics: ",
 | 
						|
                          style: TextStyle(
 | 
						|
                              fontSize: 20.0, fontWeight: FontWeight.bold)),
 | 
						|
                    ),
 | 
						|
                    ListView.builder(
 | 
						|
                      scrollDirection: Axis.vertical,
 | 
						|
                      shrinkWrap: true,
 | 
						|
                      physics: ScrollPhysics(),
 | 
						|
                      padding: EdgeInsets.all(0.0),
 | 
						|
                      itemCount: liveCareClinicsListResponse
 | 
						|
                          .patientERGetClinicsList.length,
 | 
						|
                      itemBuilder: (context, index) {
 | 
						|
                        return InkWell(
 | 
						|
                          onTap: () {
 | 
						|
                            updateSelectedIndex(liveCareClinicsListResponse
 | 
						|
                                .patientERGetClinicsList[index]);
 | 
						|
                          },
 | 
						|
                          child: ClinicCard(
 | 
						|
                            isSelected: selectedClinicID ==
 | 
						|
                                    liveCareClinicsListResponse
 | 
						|
                                        .patientERGetClinicsList[index]
 | 
						|
                                        .serviceID
 | 
						|
                                ? true
 | 
						|
                                : false,
 | 
						|
                            patientERGetClinicsList: liveCareClinicsListResponse
 | 
						|
                                .patientERGetClinicsList[index],
 | 
						|
                            languageID: languageID,
 | 
						|
                          ),
 | 
						|
                        );
 | 
						|
                      },
 | 
						|
                    ),
 | 
						|
                    Container(
 | 
						|
                      height: 10.0,
 | 
						|
                    ),
 | 
						|
                  ],
 | 
						|
                ),
 | 
						|
              )
 | 
						|
            : Container(),
 | 
						|
        isDataLoaded
 | 
						|
            ? Align(
 | 
						|
                alignment: FractionalOffset.bottomCenter,
 | 
						|
                child: Container(
 | 
						|
                  width: MediaQuery.of(context).size.width,
 | 
						|
                  height: 50.0,
 | 
						|
                  margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
 | 
						|
                  child: ButtonTheme(
 | 
						|
                    shape: RoundedRectangleBorder(
 | 
						|
                      borderRadius: BorderRadius.circular(10.0),
 | 
						|
                    ),
 | 
						|
                    minWidth: MediaQuery.of(context).size.width * 0.7,
 | 
						|
                    height: 45.0,
 | 
						|
                    child: RaisedButton(
 | 
						|
                      color: new Color(0xFF60686b),
 | 
						|
                      textColor: Colors.white,
 | 
						|
                      disabledTextColor: Colors.white,
 | 
						|
                      disabledColor: new Color(0xFFbcc2c4),
 | 
						|
                      onPressed: startLiveCare,
 | 
						|
                      child: Text("Start", style: TextStyle(fontSize: 18.0)),
 | 
						|
                    ),
 | 
						|
                  ),
 | 
						|
                ),
 | 
						|
              )
 | 
						|
            : Container(),
 | 
						|
      ],
 | 
						|
    );
 | 
						|
  }
 | 
						|
 | 
						|
  void startScheduleLiveCare() {
 | 
						|
    List<DoctorList> doctorsList = [];
 | 
						|
    LiveCareService service = new LiveCareService();
 | 
						|
    GifLoaderDialogUtils.showMyDialog(context);
 | 
						|
    List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
 | 
						|
        List();
 | 
						|
    service
 | 
						|
        .getLiveCareScheduledDoctorList(context, selectedClinicID)
 | 
						|
        .then((res) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      if (res['MessageStatus'] == 1) {
 | 
						|
        setState(() {
 | 
						|
          if (res['DoctorByClinicIDList'].length != 0) {
 | 
						|
            res['DoctorByClinicIDList'].forEach((v) {
 | 
						|
              doctorsList.add(new DoctorList.fromJson(v));
 | 
						|
            });
 | 
						|
 | 
						|
            doctorsList.forEach((element) {
 | 
						|
              List<PatientDoctorAppointmentList> doctorByHospital =
 | 
						|
                  _patientDoctorAppointmentListHospital
 | 
						|
                      .where(
 | 
						|
                        (elementClinic) =>
 | 
						|
                            elementClinic.filterName == element.projectName,
 | 
						|
                      )
 | 
						|
                      .toList();
 | 
						|
 | 
						|
              if (doctorByHospital.length != 0) {
 | 
						|
                _patientDoctorAppointmentListHospital[
 | 
						|
                        _patientDoctorAppointmentListHospital
 | 
						|
                            .indexOf(doctorByHospital[0])]
 | 
						|
                    .patientDoctorAppointmentList
 | 
						|
                    .add(element);
 | 
						|
              } else {
 | 
						|
                _patientDoctorAppointmentListHospital.add(
 | 
						|
                    PatientDoctorAppointmentList(
 | 
						|
                        filterName: element.projectName,
 | 
						|
                        distanceInKMs:
 | 
						|
                            element.projectDistanceInKiloMeters.toString(),
 | 
						|
                        patientDoctorAppointment: element));
 | 
						|
              }
 | 
						|
            });
 | 
						|
          } else {}
 | 
						|
        });
 | 
						|
        this.sharedPref.setBool(IS_LIVECARE_APPOINTMENT, true);
 | 
						|
        navigateToSearchResults(
 | 
						|
            context, doctorsList, _patientDoctorAppointmentListHospital);
 | 
						|
      } else {}
 | 
						|
    }).catchError((err) {
 | 
						|
      GifLoaderDialogUtils.hideDialog(context);
 | 
						|
      AppToast.showErrorToast(message: err);
 | 
						|
      print(err);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  Future navigateToSearchResults(
 | 
						|
      context,
 | 
						|
      List<DoctorList> docList,
 | 
						|
      List<PatientDoctorAppointmentList>
 | 
						|
          patientDoctorAppointmentListHospital) async {
 | 
						|
    Navigator.push(
 | 
						|
        context,
 | 
						|
        MaterialPageRoute(
 | 
						|
            builder: (context) => SearchResults(
 | 
						|
                doctorsList: docList,
 | 
						|
                isLiveCareAppointment: true,
 | 
						|
                patientDoctorAppointmentListHospital:
 | 
						|
                    patientDoctorAppointmentListHospital)));
 | 
						|
  }
 | 
						|
 | 
						|
  updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) {
 | 
						|
    setState(() {
 | 
						|
      selectedClinicID = patientERGetClinicsList.serviceID;
 | 
						|
      selectedClinicName = patientERGetClinicsList.serviceName;
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  updateSelectedScheduleIndex(ClinicsHaveScheduleList patientERGetClinicsList) {
 | 
						|
    setState(() {
 | 
						|
      selectedClinicID = patientERGetClinicsList.serviceID;
 | 
						|
      selectedClinicName = patientERGetClinicsList.clinicDesc;
 | 
						|
    });
 | 
						|
  }
 | 
						|
}
 |