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

288 lines
11 KiB
Dart

import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.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;
ProjectViewModel projectViewModel;
@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;
projectViewModel = Provider.of(context);
return Container(
child: Dialog(
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
child: Container(
height: 600.0,
margin: EdgeInsets.all(20.0),
width: 500.0,
color: Colors.red,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 10.0),
child: Text(TranslationBase.of(context).onlineConsultation,
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(TranslationBase.of(context).expectedWaiting,
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() + " " + TranslationBase.of(context).minute,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.red[900])),
),
],
),
Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: Text(widget.clinicName,
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(TranslationBase.of(context).erConsultFee,
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, right: 10.0),
width: MediaQuery.of(context).size.width * 0.55,
child: Text(TranslationBase.of(context).insuredPatient,
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(
TranslationBase.of(context).iAcceptTerms,
style: new TextStyle(fontSize: 14.0),
),
),
],
),
),
Divider(
thickness: 1.0,
color: Colors.grey[400],
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: new Text(
TranslationBase.of(context).upComingPayOption,
style: new TextStyle(fontSize: 14.0),
),
),
Container(margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), child: getPaymentMethods()),
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(TranslationBase.of(context).cancel,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0, color: Colors.red[700])),
),
),
),
Expanded(
child: InkWell(
onTap: () {
if (_selected == 0) {
AppToast.showErrorToast(
message: TranslationBase.of(context)
.pleaseAcceptTerms);
} else {
Navigator.pop(context, true);
}
},
child: Container(
child: Text(TranslationBase.of(context).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.start,
style: TextStyle(
fontSize: 14,
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.start,
style: TextStyle(
fontSize: 14,
letterSpacing: 0.5,
fontWeight: FontWeight.bold,
color: Colors.black)),
);
}
}