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.
781 lines
27 KiB
Dart
781 lines
27 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/Appointments/PatientShareResposne.dart';
|
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
|
import 'package:diplomaticquarterapp/models/header_model.dart';
|
|
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
|
|
import 'package:diplomaticquarterapp/routes.dart';
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
import 'package:diplomaticquarterapp/theme/colors.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/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
|
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
|
|
|
import 'QRCode.dart';
|
|
|
|
class BookSuccess extends StatefulWidget {
|
|
PatientShareResponse patientShareResponse;
|
|
DoctorList docObject;
|
|
|
|
MyInAppBrowser browser;
|
|
final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser());
|
|
|
|
String appoDateFormatted;
|
|
String appoTimeFormatted;
|
|
|
|
BookSuccess({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted});
|
|
|
|
@override
|
|
_BookSuccessState createState() => _BookSuccessState();
|
|
}
|
|
|
|
class _BookSuccessState extends State<BookSuccess> {
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
AuthenticatedUser authUser;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: widget.docObject.doctorTitle + " " + widget.docObject.name,
|
|
isShowDecPage: false,
|
|
isShowAppBar: true,
|
|
showNewAppBarTitle: true,
|
|
showNewAppBar: true,
|
|
backgroundColor: CustomColors.appBackgroudGreyColor,
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
DoctorHeader(
|
|
headerModel: HeaderModel(
|
|
widget.docObject.name,
|
|
widget.docObject.doctorID,
|
|
widget.docObject.doctorImageURL,
|
|
widget.docObject.speciality,
|
|
"",
|
|
widget.docObject.projectName,
|
|
null,
|
|
null,
|
|
widget.docObject.nationalityFlagURL,
|
|
widget.docObject.doctorRate,
|
|
null,
|
|
widget.docObject.noOfPatientsRate,
|
|
"",
|
|
),
|
|
isNeedToShowButton: false,
|
|
),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
color: CustomColors.green,
|
|
child: Table(
|
|
border: TableBorder(verticalInside: BorderSide(width: 0.5, color: Colors.white)),
|
|
children: [
|
|
TableRow(
|
|
children: [
|
|
TableCell(child: _getNormalText(TranslationBase.of(context).patientShare)),
|
|
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareWithTax)),
|
|
],
|
|
),
|
|
TableRow(
|
|
children: [
|
|
TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShare.toString())),
|
|
TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShareWithTax.toString())),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
getNextActionWidget(),
|
|
],
|
|
),
|
|
),
|
|
bottomSheet: getBottomContainer(),
|
|
);
|
|
}
|
|
|
|
Widget getBottomContainer() {
|
|
switch (widget.patientShareResponse.nextAction) {
|
|
case 0:
|
|
return Container();
|
|
break;
|
|
case 10:
|
|
return _getConfirmAppoButtons();
|
|
break;
|
|
case 15:
|
|
return _getPaymentPendingAppo();
|
|
break;
|
|
case 20:
|
|
return _getPayNowButtons();
|
|
break;
|
|
case 30:
|
|
return _getQRButtons();
|
|
break;
|
|
case 50:
|
|
return _getConfirmAppoButtons();
|
|
break;
|
|
}
|
|
}
|
|
|
|
Widget _getQRButtons() {
|
|
return Container(
|
|
alignment: Alignment.bottomCenter,
|
|
height: MediaQuery.of(context).size.height * 0.18,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: <Widget>[
|
|
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: () {
|
|
// navigateToQR(context);
|
|
getAppoQR(context);
|
|
},
|
|
child: Text(TranslationBase.of(context).viewQR.toUpperCase(), style: TextStyle(fontSize: 18.0)),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _getPayNowButtons() {
|
|
return Container(
|
|
color: CustomColors.appBackgroudGreyColor,
|
|
child: Container(
|
|
color: CustomColors.appBackgroudGreyColor,
|
|
margin: EdgeInsets.all(14),
|
|
height: 45.0,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: ButtonTheme(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
height: 45.0,
|
|
child: RaisedButton(
|
|
color: CustomColors.green,
|
|
textColor: Colors.white,
|
|
disabledTextColor: Colors.white,
|
|
disabledColor: new Color(0xFFbcc2c4),
|
|
onPressed: () {
|
|
startPaymentProcess();
|
|
},
|
|
child: Text(TranslationBase.of(context).payNow.toUpperCase(), style: TextStyle(fontSize: 18.0)),
|
|
),
|
|
),
|
|
),
|
|
mWidth(7),
|
|
Expanded(
|
|
flex: 1,
|
|
child: ButtonTheme(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
height: 45.0,
|
|
child: RaisedButton(
|
|
color: new Color(0xffc5272d),
|
|
textColor: Colors.white,
|
|
disabledTextColor: Colors.white,
|
|
disabledColor: new Color(0xFFbcc2c4),
|
|
onPressed: () {
|
|
navigateToHome(context);
|
|
},
|
|
child: Text(TranslationBase.of(context).payLater.toUpperCase(), style: TextStyle(fontSize: 18.0)),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _getConfirmAppoButtons() {
|
|
return Container(
|
|
color: CustomColors.appBackgroudGreyColor,
|
|
child: Container(
|
|
color: CustomColors.appBackgroudGreyColor,
|
|
margin: EdgeInsets.all(14),
|
|
height: 45.0,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: ButtonTheme(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
height: 45.0,
|
|
child: RaisedButton(
|
|
color: new Color(0xffc5272d),
|
|
textColor: Colors.white,
|
|
disabledTextColor: Colors.white,
|
|
disabledColor: new Color(0xFFbcc2c4),
|
|
onPressed: () {
|
|
navigateToHome(context);
|
|
},
|
|
child: Text(TranslationBase.of(context).confirmLater, style: TextStyle(fontSize: 18.0)),
|
|
),
|
|
),
|
|
),
|
|
mWidth(7),
|
|
Expanded(
|
|
flex: 1,
|
|
child: ButtonTheme(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
height: 45.0,
|
|
child: RaisedButton(
|
|
color: CustomColors.green,
|
|
textColor: Colors.white,
|
|
disabledTextColor: Colors.white,
|
|
disabledColor: new Color(0xFFbcc2c4),
|
|
onPressed: () {
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
appo.clinicID = widget.docObject.clinicID;
|
|
appo.projectID = widget.docObject.projectID;
|
|
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
|
|
appo.serviceID = widget.patientShareResponse.serviceID;
|
|
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
|
|
appo.doctorID = widget.patientShareResponse.doctorID;
|
|
confirmAppointment(appo);
|
|
},
|
|
child: Text(widget.patientShareResponse.isLiveCareAppointment ? TranslationBase.of(context).confirmLiveCare : TranslationBase.of(context).confirm,
|
|
style: TextStyle(fontSize: 18.0)),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget getNextActionWidget() {
|
|
switch (widget.patientShareResponse.nextAction) {
|
|
case 0:
|
|
return Container();
|
|
break;
|
|
case 10:
|
|
return _getConfirmAppo();
|
|
break;
|
|
case 15:
|
|
return _getPaymentPendingAppo();
|
|
break;
|
|
case 20:
|
|
return _getPayNowAppo();
|
|
break;
|
|
case 30:
|
|
return _getQRAppo();
|
|
break;
|
|
case 50:
|
|
return _getConfirmAppo();
|
|
break;
|
|
}
|
|
}
|
|
|
|
String getNextAction() {
|
|
switch (widget.patientShareResponse.nextAction) {
|
|
case 0:
|
|
return 'No Action';
|
|
break;
|
|
case 10:
|
|
return 'Confirm';
|
|
break;
|
|
case 15:
|
|
return 'Payment Pending';
|
|
break;
|
|
case 20:
|
|
return 'Pay Now';
|
|
break;
|
|
case 30:
|
|
return 'QR Code';
|
|
break;
|
|
case 50:
|
|
return 'Confirm LiveCare';
|
|
break;
|
|
}
|
|
}
|
|
|
|
Widget _getConfirmAppo() {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Container(
|
|
margin: EdgeInsets.only(top: 30.0, bottom: 40.0),
|
|
alignment: Alignment.center,
|
|
child: Text(TranslationBase.of(context).confirmAppo, style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)),
|
|
),
|
|
Flex(
|
|
direction: Axis.horizontal,
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.only(left: 10.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
_getBulletPoint("1"),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
child: Text(TranslationBase.of(context).upcomingConfirm, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Flex(
|
|
direction: Axis.horizontal,
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.only(top: 20.0, left: 10.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
_getBulletPoint("2"),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
child: Text(TranslationBase.of(context).upcomingConfirmMore, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Container(margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), child: getPaymentMethods()),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _getPaymentPendingAppo() {
|
|
return Container();
|
|
}
|
|
|
|
confirmAppointment(AppoitmentAllHistoryResultList appo) {
|
|
DoctorsListService service = new DoctorsListService();
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
if (res['MessageStatus'] == 1) {
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
if (appo.isLiveCareAppointment) {
|
|
insertLiveCareVIDARequest(appo);
|
|
} else {
|
|
navigateToHome(context);
|
|
}
|
|
} else {
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: err);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) {
|
|
DoctorsListService service = new DoctorsListService();
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
if (res['MessageStatus'] == 1) {
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
navigateToHome(context);
|
|
} else {
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: err);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
Widget _getPayNowAppo() {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(left: 20, right: 20, top: 24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Text(
|
|
TranslationBase.of(context).payNowBookSuccess,
|
|
style: TextStyle(
|
|
fontSize: 24.0,
|
|
letterSpacing: -1.44,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
TranslationBase.of(context).neverWait,
|
|
style: TextStyle(
|
|
fontSize: 12.0,
|
|
letterSpacing: -0.54,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
mHeight(24),
|
|
Text(TranslationBase.of(context).payNowBookSuccesstext1,
|
|
overflow: TextOverflow.fade,
|
|
style: TextStyle(
|
|
fontSize: 12.0,
|
|
letterSpacing: -0.36,
|
|
)),
|
|
Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()),
|
|
Text(
|
|
TranslationBase.of(context).payNowBookSuccesstext2,
|
|
overflow: TextOverflow.clip,
|
|
style: TextStyle(
|
|
fontSize: 12.0,
|
|
letterSpacing: -0.36,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
startPaymentProcess() {
|
|
navigateToPaymentMethod(context, widget.patientShareResponse);
|
|
}
|
|
|
|
Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse) async {
|
|
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
|
|
var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
|
|
setState(() {
|
|
authUser = data;
|
|
});
|
|
}
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
appo.projectID = widget.patientShareResponse.projectID;
|
|
appo.clinicID = widget.patientShareResponse.clinicID;
|
|
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
|
|
|
|
Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) {
|
|
setState(() {});
|
|
}))).then((value) {
|
|
if (value != null) {
|
|
openPayment(value, authUser, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo);
|
|
}
|
|
});
|
|
}
|
|
|
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async {
|
|
widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
|
|
|
|
widget.browser.openPaymentBrowser(
|
|
amount,
|
|
"Appointment check in",
|
|
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo),
|
|
appo.projectID.toString(),
|
|
authenticatedUser.emailAddress,
|
|
paymentMethod,
|
|
authenticatedUser.patientType,
|
|
authenticatedUser.firstName,
|
|
authenticatedUser.patientID,
|
|
authenticatedUser,
|
|
widget.browser,
|
|
widget.patientShareResponse.isLiveCareAppointment,
|
|
"2",
|
|
"",
|
|
widget.patientShareResponse.appointmentDate,
|
|
widget.patientShareResponse.appointmentNo,
|
|
widget.patientShareResponse.clinicID,
|
|
widget.patientShareResponse.doctorID);
|
|
// }
|
|
}
|
|
|
|
onBrowserLoadStart(String url) {
|
|
print(url);
|
|
|
|
MyInAppBrowser.successURLS.forEach((element) {
|
|
if (url.contains(element)) {
|
|
if (widget.browser.isOpened()) widget.browser.close();
|
|
MyInAppBrowser.isPaymentDone = true;
|
|
return;
|
|
}
|
|
});
|
|
|
|
MyInAppBrowser.errorURLS.forEach((element) {
|
|
if (url.contains(element)) {
|
|
if (widget.browser.isOpened()) widget.browser.close();
|
|
MyInAppBrowser.isPaymentDone = false;
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
|
if (isPaymentMade) checkPaymentStatus(appo);
|
|
}
|
|
|
|
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
DoctorsListService service = new DoctorsListService();
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
|
|
String paymentInfo = res['Response_Message'];
|
|
if (paymentInfo == 'Success') {
|
|
createAdvancePayment(res, appo);
|
|
} else {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: res['Response_Message']);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: err);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
getApplePayAPQ(AppoitmentAllHistoryResultList appo) {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
DoctorsListService service = new DoctorsListService();
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
String paymentInfo = res['Response_Message'];
|
|
if (paymentInfo == 'Success') {
|
|
createAdvancePayment(res, appo);
|
|
} else {
|
|
AppToast.showErrorToast(message: res['Response_Message']);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: err);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
|
|
DoctorsListService service = new DoctorsListService();
|
|
String paymentReference = res['Fort_id'].toString();
|
|
service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) {
|
|
addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString());
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: err);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID) {
|
|
DoctorsListService service = new DoctorsListService();
|
|
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {
|
|
print(res);
|
|
getAppoQR(context);
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: err);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
Widget _getQRAppo() {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Container(
|
|
margin: EdgeInsets.only(top: 30.0, bottom: 40.0),
|
|
alignment: Alignment.center,
|
|
child: Text(TranslationBase.of(context).noNeedToWaitInLine, style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)),
|
|
),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
child: Image.asset("assets/images/new-design/device_icon.png", width: 120.0, height: 120.0),
|
|
),
|
|
Flex(
|
|
direction: Axis.horizontal,
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.only(left: 10.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Container(
|
|
margin: EdgeInsets.only(top: 15.0),
|
|
child: Row(
|
|
children: <Widget>[
|
|
_getBulletPoint("1"),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
child: Text(TranslationBase.of(context).useQRAppoAttend, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 15.0),
|
|
child: Row(
|
|
children: <Widget>[
|
|
_getBulletPoint("2"),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
child: Text(TranslationBase.of(context).passQRAppoAttend, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 15.0),
|
|
child: Row(
|
|
children: <Widget>[
|
|
_getBulletPoint("3"),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
child: Text(TranslationBase.of(context).sitWaitingQR, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
// Container(
|
|
// alignment: Alignment.bottomCenter,
|
|
// height: MediaQuery.of(context).size.height * 0.18,
|
|
// child: Column(
|
|
// mainAxisAlignment: MainAxisAlignment.end,
|
|
// children: <Widget>[
|
|
// 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: () {
|
|
// // navigateToQR(context);
|
|
// getAppoQR(context);
|
|
// },
|
|
// child: Text(TranslationBase.of(context).viewQR.toUpperCase(),
|
|
// style: TextStyle(fontSize: 18.0)),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
],
|
|
);
|
|
}
|
|
|
|
_getTextStyling() {
|
|
return TextStyle(fontSize: 14.0, color: Colors.white, letterSpacing: 0.7);
|
|
}
|
|
|
|
_getBulletPoint(bulletPoint) {
|
|
return Container(
|
|
margin: EdgeInsets.only(left: 20.0, right: 20.0),
|
|
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.black),
|
|
width: 20.0,
|
|
height: 20.0,
|
|
child: Center(
|
|
child: Text(bulletPoint,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 12.0,
|
|
)),
|
|
),
|
|
);
|
|
}
|
|
|
|
_getHeadingText(text) {
|
|
return Container(
|
|
padding: EdgeInsets.only(bottom: 10.0, left: 20, right: 20),
|
|
child: Text(
|
|
text,
|
|
textAlign: TextAlign.start,
|
|
style: TextStyle(
|
|
fontSize: 16.0,
|
|
letterSpacing: -0.64,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Future navigateToHome(context) async {
|
|
Navigator.of(context).popAndPushNamed(HOME);
|
|
}
|
|
|
|
getAppoQR(context) {
|
|
DoctorsListService service = new DoctorsListService();
|
|
service.generateAppointmentQR(widget.patientShareResponse, context).then((res) {
|
|
print(res);
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
navigateToQR(context, res['AppointmentQR']);
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showErrorToast(message: err);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
Future navigateToQR(context, String appoQR) async {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: QRCode(
|
|
patientShareResponse: widget.patientShareResponse,
|
|
appoQR: appoQR,
|
|
)));
|
|
}
|
|
|
|
_getNormalText(text) {
|
|
return Container(
|
|
margin: EdgeInsets.only(top: 5.0, left: 20, right: 20),
|
|
padding: EdgeInsets.only(top: 5.0, bottom: 0),
|
|
child: Text(text,
|
|
textAlign: TextAlign.start,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
letterSpacing: -0.36,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
)),
|
|
);
|
|
}
|
|
}
|