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.
232 lines
9.8 KiB
Dart
232 lines
9.8 KiB
Dart
import 'package:circular_countdown_timer/circular_countdown_timer.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart';
|
|
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/my_rich_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class LiveCarePendingRequest extends StatefulWidget {
|
|
ErRequestHistoryList pendingERRequestHistoryList;
|
|
final Function getLiveCareHistory;
|
|
|
|
LiveCarePendingRequest({@required this.getLiveCareHistory, this.pendingERRequestHistoryList});
|
|
|
|
@override
|
|
_LiveCarePendingRequestState createState() => _LiveCarePendingRequestState();
|
|
}
|
|
|
|
class _LiveCarePendingRequestState extends State<LiveCarePendingRequest> {
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
return Container(
|
|
margin: EdgeInsets.fromLTRB(21, 21, 21, 12),
|
|
padding: EdgeInsets.all(10.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
decoration: cardRadius(15.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.fromLTRB(16, 21, 16, 23),
|
|
child: Text(TranslationBase.of(context).waitingTime, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)),
|
|
),
|
|
Container(
|
|
height: MediaQuery.of(context).size.height * 0.25,
|
|
transform: Matrix4.translationValues(0.0, -10.0, 0.0),
|
|
alignment: Alignment.center,
|
|
child: CircularCountDownTimer(
|
|
duration: widget.pendingERRequestHistoryList.watingtimeInteger * 60,
|
|
width: MediaQuery.of(context).size.width / 2,
|
|
height: MediaQuery.of(context).size.height / 2,
|
|
color: Colors.white,
|
|
fillColor: CustomColors.green,
|
|
strokeWidth: 7.0,
|
|
textStyle: TextStyle(fontSize: 32.0, color: Color(0xff2E303A), fontWeight: FontWeight.w400),
|
|
isReverse: true,
|
|
isTimerTextShown: true,
|
|
onComplete: () {
|
|
print('Countdown Ended');
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: const EdgeInsets.fromLTRB(0, 12, 0, 0),
|
|
padding: const EdgeInsets.fromLTRB(16, 21, 16, 12),
|
|
width: MediaQuery.of(context).size.width,
|
|
decoration: cardRadius(15.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
decoration: cardRadius(15.0, color: Color(0xffCC9B14)),
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: Text(widget.pendingERRequestHistoryList.stringCallStatus, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4)),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: MyRichText(TranslationBase.of(context).requestedDateLiveCare,
|
|
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.pendingERRequestHistoryList.arrivalTime)), projectViewModel.isArabic),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: Text(TranslationBase.of(context).yourTurn + " " + widget.pendingERRequestHistoryList.patCount.toString() + " " + TranslationBase.of(context).patients,
|
|
style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.48)),
|
|
),
|
|
// Container(
|
|
// child: DefaultButton(TranslationBase.of(context).cancel, () {
|
|
// cancelLiveCareRequest();
|
|
// }),
|
|
// ),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
// Column(
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
// mainAxisSize: MainAxisSize.min,
|
|
// children: <Widget>[
|
|
// Container(
|
|
// child: Text("In Progress:",
|
|
// style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
|
|
// ),
|
|
// Container(
|
|
// alignment: Alignment.center,
|
|
// margin: EdgeInsets.only(top: 10.0),
|
|
// child: Text("Estimated Waiting Time: ",
|
|
// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
|
|
// ),
|
|
// Container(
|
|
// transform: Matrix4.translationValues(0.0, -50.0, 0.0),
|
|
// alignment: Alignment.center,
|
|
// child: CircularCountDownTimer(
|
|
// duration:
|
|
// widget.pendingERRequestHistoryList.watingtimeInteger * 60,
|
|
// width: MediaQuery.of(context).size.width / 3,
|
|
// height: MediaQuery.of(context).size.height / 3,
|
|
// color: Colors.white,
|
|
// fillColor: Colors.green[700],
|
|
// strokeWidth: 15.0,
|
|
// textStyle: TextStyle(
|
|
// fontSize: 22.0,
|
|
// color: Colors.black87,
|
|
// fontWeight: FontWeight.bold),
|
|
// isReverse: true,
|
|
// isTimerTextShown: true,
|
|
// onComplete: () {
|
|
// print('Countdown Ended');
|
|
// },
|
|
// ),
|
|
// ),
|
|
// Container(
|
|
// transform: Matrix4.translationValues(0.0, -60.0, 0.0),
|
|
// child: Divider(
|
|
// color: Colors.grey[500],
|
|
// thickness: 0.7,
|
|
// ),
|
|
// ),
|
|
// Container(
|
|
// transform: Matrix4.translationValues(0.0, -50.0, 0.0),
|
|
// child: Text("Requested date:",
|
|
// style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
|
|
// ),
|
|
// Container(
|
|
// transform: Matrix4.translationValues(0.0, -30.0, 0.0),
|
|
// child: Text(
|
|
// DateUtil.getDateFormatted(
|
|
// widget.pendingERRequestHistoryList.arrivalTime),
|
|
// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
|
|
// ),
|
|
// Container(
|
|
// transform: Matrix4.translationValues(0.0, -20.0, 0.0),
|
|
// padding: EdgeInsets.all(7.0),
|
|
// decoration: BoxDecoration(
|
|
// shape: BoxShape.rectangle,
|
|
// borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
// color: Colors.red[800],
|
|
// ),
|
|
// margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
|
// child: Text(widget.pendingERRequestHistoryList.stringCallStatus,
|
|
// style: TextStyle(fontSize: 14.0, color: Colors.white)),
|
|
// ),
|
|
// Container(
|
|
// transform: Matrix4.translationValues(0.0, 0.0, 0.0),
|
|
// child: Divider(
|
|
// color: Colors.grey[500],
|
|
// thickness: 0.7,
|
|
// ),
|
|
// ),
|
|
// Container(
|
|
// alignment: Alignment.center,
|
|
// transform: Matrix4.translationValues(0.0, 10.0, 0.0),
|
|
// child: Text(
|
|
// "Your turn is after " +
|
|
// widget.pendingERRequestHistoryList.patCount.toString() +
|
|
// " Patients",
|
|
// style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
|
|
// ),
|
|
// Container(
|
|
// transform: Matrix4.translationValues(0.0, 110.0, 0.0),
|
|
// alignment: Alignment.bottomCenter,
|
|
// width: MediaQuery.of(context).size.width,
|
|
// child: ButtonTheme(
|
|
// shape: RoundedRectangleBorder(
|
|
// borderRadius: BorderRadius.circular(10.0),
|
|
// ),
|
|
// minWidth: MediaQuery.of(context).size.width,
|
|
// height: 45.0,
|
|
// child: RaisedButton(
|
|
// color: Colors.red[800],
|
|
// textColor: Colors.white,
|
|
// elevation: 0,
|
|
// disabledTextColor: Colors.white,
|
|
// disabledColor: new Color(0xFFbcc2c4),
|
|
// onPressed: () {
|
|
// cancelLiveCareRequest();
|
|
// },
|
|
// child: Text(TranslationBase.of(context).cancel,
|
|
// style: TextStyle(fontSize: 18.0)),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
);
|
|
}
|
|
|
|
cancelLiveCareRequest() {
|
|
LiveCareService service = new LiveCareService();
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
service.cancelLiveCareRequest(widget.pendingERRequestHistoryList.vCID, context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
AppToast.showSuccessToast(message: "LiveCare request cancelled successfully");
|
|
widget.getLiveCareHistory();
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
});
|
|
}
|
|
}
|