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.
HMG_Patient_App/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart

297 lines
11 KiB
Dart

import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
class LiveCarePaymentDialog extends StatefulWidget {
GetERAppointmentFeesList getERAppointmentFeesList;
int waitingTime;
String clinicName;
LiveCarePaymentDialog(
{@required this.getERAppointmentFeesList, @required this.waitingTime, @required this.clinicName});
@override
_LiveCarePaymentDialogState createState() => _LiveCarePaymentDialogState();
}
class _LiveCarePaymentDialogState extends State<LiveCarePaymentDialog> {
int _selected = 0;
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2;
final double itemWidth = size.width / 2;
return Container(
child: Dialog(
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
child: Container(
height: MediaQuery.of(context).size.height * 0.691,
margin: EdgeInsets.all(20.0),
width: 450.0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 10.0),
child: Text("Online Consultation",
textAlign: TextAlign.center,
style:
TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
),
Divider(
thickness: 1.0,
color: Colors.grey[400],
),
Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
child: Text("Waiting time to start LiveCare consultation",
textAlign: TextAlign.end,
style: TextStyle(fontSize: 13.0)),
),
Expanded(
child: Container(
child: Icon(Icons.access_time,
size: 36.0, color: Colors.red[800]),
),
),
Expanded(
child: Text(widget.waitingTime.toString() + " Minutes",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.red[900])),
),
],
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: Text(widget.clinicName,
textAlign: TextAlign.center,
style:
TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)),
),
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Colors.black87,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(5.0),
topRight: const Radius.circular(5.0),
),
border: Border.all(color: Colors.black87)),
alignment: Alignment.center,
margin: EdgeInsets.only(top: 5.0),
padding: EdgeInsets.all(5.0),
child: Text("Consultation fee",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Colors.white)),
),
Container(
decoration: BoxDecoration(
borderRadius: new BorderRadius.only(
bottomLeft: const Radius.circular(5.0),
bottomRight: const Radius.circular(5.0),
),
border: Border.all(color: Colors.black54)),
child: Table(
children: [
TableRow(children: [
TableCell(
child: _getNormalText(
TranslationBase.of(context).patientShareToDo)),
TableCell(
child: _getNormalText(
widget.getERAppointmentFeesList.amount +
" " +
widget.getERAppointmentFeesList.currency)),
]),
TableRow(children: [
TableCell(
child: _getNormalText(
TranslationBase.of(context).patientTaxToDo)),
TableCell(
child: _getNormalText(
widget.getERAppointmentFeesList.tax +
" " +
widget.getERAppointmentFeesList.currency)),
]),
TableRow(children: [
TableCell(
child: _getMarginText(TranslationBase.of(context)
.patientShareTotalToDo)),
TableCell(
child: _getMarginText(
widget.getERAppointmentFeesList.total +
" " +
widget.getERAppointmentFeesList.currency)),
]),
],
),
),
Container(
padding: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 10.0),
decoration: BoxDecoration(
borderRadius: new BorderRadius.all(
const Radius.circular(5.0),
),
color: Colors.green[200].withOpacity(0.5)),
margin: EdgeInsets.only(top: 20.0),
child: Row(
children: <Widget>[
Image.asset("assets/images/new-design/alert-triangle.png"),
Container(
margin: EdgeInsets.only(left: 10.0),
width: MediaQuery.of(context).size.width * 0.55,
child: Text(
"If you're Insurance patient, you have only have to pay the co-payment",
style: TextStyle(fontSize: 13.0)),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Row(
children: <Widget>[
Container(
child: new Radio(
value: 1,
groupValue: _selected,
onChanged: onRadioChanged,
),
),
Container(
child: new Text(
'I Accept the Terms And Conditions',
style: new TextStyle(fontSize: 14.0),
),
),
// Container(
//// alignment: Alignment.centerRight,
// child: new Text(
// 'Click Here',
// textAlign: TextAlign.end,
// style: new TextStyle(fontSize: 16.0),
// ),
// ),
],
),
),
Divider(
thickness: 1.0,
color: Colors.grey[400],
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 10.0),
child: new Text(
'You can pay by the following Options:',
textAlign: TextAlign.center,
style: new TextStyle(fontSize: 14.0),
),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0),
child: Image.asset(
"assets/images/new-design/payment_options_invoice_confirmation.png",
width: 300),
),
Divider(
thickness: 1.0,
color: Colors.grey[400],
),
Container(
alignment: Alignment.center,
height: 40.0,
child: Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
child: InkWell(
onTap: () {
Navigator.pop(context, false);
},
child: Container(
child: Text("Cancel",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0, color: Colors.red[700])),
),
),
),
Expanded(
child: InkWell(
onTap: () {
if(_selected == 0) {
AppToast.showErrorToast(message: "Please accept terms & conditions to continue");
} else {
Navigator.pop(context, true);
}
},
child: Container(
child: Text("Ok",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0,
)),
),
),
),
],
),
),
],
),
),
),
);
}
void onRadioChanged(int value) {
setState(() {
_selected = value;
});
}
_getNormalText(text) {
return Container(
margin: EdgeInsets.only(top: 10.0, right: 10.0),
child: Text(text,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14,
fontFamily: 'Open-Sans',
letterSpacing: 0.5,
color: Colors.black)),
);
}
_getMarginText(text) {
return Container(
margin: EdgeInsets.only(top: 10.0, right: 10.0, bottom: 10.0),
child: Text(text,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14,
fontFamily: 'Open-Sans',
letterSpacing: 0.5,
fontWeight: FontWeight.bold,
color: Colors.black)),
);
}
}