blood pressure, blood sugar, weight, order log & send feedback dialog changes and improvements (cont).

merge-requests/443/merge
Sikander Saleem 4 years ago
parent 0b4305de03
commit ecb6315f9c

@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -28,6 +29,29 @@ class OrdersLogDetailsPage extends StatelessWidget {
ProjectViewModel projectViewModel = Provider.of(context);
void showConfirmMessage(CMCViewModel model, GetHHCAllPresOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
Future.delayed(new Duration(milliseconds: 300)).then((value) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.updateCmcPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
GifLoaderDialogUtils.hideDialog(context);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getCmcAllPresOrders();
GifLoaderDialogUtils.hideDialog(context);
}
});
},
));
return;
// todo 'sikander' remove useless code
showDialog(
context: context,
child: ConfirmCancelOrderDialog(

@ -8,8 +8,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.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/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -26,6 +25,28 @@ class OrdersLogDetailsPage extends StatelessWidget {
ProjectViewModel projectViewModel = Provider.of(context);
void showConfirmMessage(HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
message: TranslationBase.of(context).cancelOrderMsg,
onTap: () async {
UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3);
model.setState(ViewState.Busy);
await model.updateHHCPresOrder(updatePresOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully);
await model.getHHCAllPresOrders();
// await model.getHHCAllServices();
}
},
),
);
return;
// todo 'sikander' remove useless code
showDialog(
context: context,
child: ConfirmCancelOrderDialog(
@ -49,128 +70,130 @@ class OrdersLogDetailsPage extends StatelessWidget {
return AppScaffold(
isShowAppBar: false,
baseViewModel: model,
body: model.hhcAllPresOrders.length > 0 ? ListView.separated(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
GetHHCAllPresOrdersResponseModel order = model.hhcAllPresOrders[index];
body: model.hhcAllPresOrders.length > 0
? ListView.separated(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
GetHHCAllPresOrdersResponseModel order = model.hhcAllPresOrders[index];
int status = order.status;
String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description;
Color _color;
if (status == 1) {
//pending
_color = Color(0xffCC9B14);
} else if (status == 2) {
//processing
_color = Color(0xff2E303A);
} else if (status == 3) {
//completed
_color = Color(0xff359846);
} else if (status == 4) {
//cancel // Rejected
_color = Color(0xffD02127);
}
return Container(
decoration: BoxDecoration(
color: _color,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
child: Container(
// decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.only(
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
int status = order.status;
String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description;
Color _color;
if (status == 1) {
//pending
_color = Color(0xffCC9B14);
} else if (status == 2) {
//processing
_color = Color(0xff2E303A);
} else if (status == 3) {
//completed
_color = Color(0xff359846);
} else if (status == 4) {
//cancel // Rejected
_color = Color(0xffD02127);
}
return Container(
decoration: BoxDecoration(
color: _color,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
),
// clipBehavior: Clip.antiAlias,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_statusDisp,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
),
SizedBox(height: 6),
Text(
'${TranslationBase.of(context).requestID}: ${order.iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
Row(
child: Container(
// decoration: containerColorRadiusLeft(Colors.white, 12),
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.only(
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
),
),
// clipBehavior: Clip.antiAlias,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).hospital + ": ",
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
_statusDisp,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
),
Expanded(
child: Text(
!projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
),
SizedBox(height: 6),
Text(
'${TranslationBase.of(context).requestID}: ${order.iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).hospital + ": ",
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
Expanded(
child: Text(
!projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
),
),
],
)
],
)
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
),
),
SizedBox(height: 12),
if (order.status == 1 || order.status == 2)
InkWell(
onTap: () {
showConfirmMessage(model, order);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
decoration: BoxDecoration(
color: Color(0xffD02127),
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.circular(10),
),
child: Text(
TranslationBase.of(context).cancel_nocaps,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
),
),
SizedBox(height: 12),
if (order.status == 1 || order.status == 2)
InkWell(
onTap: () {
showConfirmMessage(model, order);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
decoration: BoxDecoration(
color: Color(0xffD02127),
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.circular(10),
),
child: Text(
TranslationBase.of(context).cancel_nocaps,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
),
),
),
],
),
],
),
],
),
),
);
},
separatorBuilder: (context, index) => SizedBox(height: 12),
itemCount: model.hhcAllPresOrders.length) : getNoDataWidget(context),
),
);
},
separatorBuilder: (context, index) => SizedBox(height: 12),
itemCount: model.hhcAllPresOrders.length)
: getNoDataWidget(context),
);
}
}

@ -499,41 +499,41 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
return;
// todo 'sikander' remove useless code
showDialog(
context: context,
child: FeedbackTypeDialog(
messageTypeDialog: messageType,
onValueSelected: (MessageType value) {
if (value == MessageType.ComplaintOnAnAppointment) {
appoList.clear();
GifLoaderDialogUtils.showMyDialog(context);
service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) {
GifLoaderDialogUtils.hideDialog(context);
setState(() {
if (res['MessageStatus'] == 1) {
if (res['AppoimentAllHistoryResultList'].length != 0) {
res['AppoimentAllHistoryResultList'].forEach((v) {
appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
});
setState(() {
appointHistory = null;
isShowListAppointHistory = true;
});
} else {}
} else {}
});
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
// print(err);
// AppToast.showErrorToast(message: err);
// Navigator.of(context).pop();
});
} else {
isShowListAppointHistory = false;
}
setMessageType(value);
},
));
// showDialog(
// context: context,
// child: FeedbackTypeDialog(
// messageTypeDialog: messageType,
// onValueSelected: (MessageType value) {
// if (value == MessageType.ComplaintOnAnAppointment) {
// appoList.clear();
// GifLoaderDialogUtils.showMyDialog(context);
// service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) {
// GifLoaderDialogUtils.hideDialog(context);
// setState(() {
// if (res['MessageStatus'] == 1) {
// if (res['AppoimentAllHistoryResultList'].length != 0) {
// res['AppoimentAllHistoryResultList'].forEach((v) {
// appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
// });
// setState(() {
// appointHistory = null;
// isShowListAppointHistory = true;
// });
// } else {}
// } else {}
// });
// }).catchError((err) {
// GifLoaderDialogUtils.hideDialog(context);
// // print(err);
// // AppToast.showErrorToast(message: err);
// // Navigator.of(context).pop();
// });
// } else {
// isShowListAppointHistory = false;
// }
// setMessageType(value);
// },
// ));
}
openSpeechReco() async {
@ -587,238 +587,238 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
if (!mounted) return;
}
}
class FeedbackTypeDialog extends StatefulWidget {
final Function(MessageType) onValueSelected;
final MessageType messageTypeDialog;
const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) : super(key: key);
@override
State createState() => new FeedbackTypeDialogState();
}
class FeedbackTypeDialogState extends State<FeedbackTypeDialog> {
MessageType messageTypeDialog = MessageType.NON;
setMessageDialogType(MessageType messageType) {
setState(() {
messageTypeDialog = messageType;
});
}
@override
void initState() {
messageTypeDialog = widget.messageTypeDialog;
super.initState();
}
Widget build(BuildContext context) {
return BaseView<FeedbackViewModel>(
builder: (_, model, widge) => SimpleDialog(
title: Text(
TranslationBase.of(context).messageType,
textAlign: TextAlign.center,
),
children: <Widget>[
Container(
// padding: const EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Divider(
height: 2.5,
color: Colors.grey[500],
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => setMessageDialogType(MessageType.NON),
child: ListTile(
title: Texts(TranslationBase.of(context).notClassified),
leading: Radio(
value: MessageType.NON,
groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value),
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => setMessageDialogType(MessageType.ComplaintOnAnAppointment),
child: ListTile(
title: Texts(TranslationBase.of(context).complainAppo),
leading: Radio(
value: MessageType.ComplaintOnAnAppointment,
groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value),
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => setMessageDialogType(MessageType.ComplaintWithoutAppointment),
child: ListTile(
title: Texts(TranslationBase.of(context).complainWithoutAppo),
leading: Radio(
value: MessageType.ComplaintWithoutAppointment,
groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value),
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => setMessageDialogType(MessageType.Question),
child: ListTile(
title: Texts(TranslationBase.of(context).question),
leading: Radio(
value: MessageType.Question,
groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value),
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => setMessageDialogType(MessageType.Compliment),
child: ListTile(
title: Texts(TranslationBase.of(context).compliment),
leading: Radio(
value: MessageType.Compliment,
groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value),
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => setMessageDialogType(MessageType.Suggestion),
child: ListTile(
title: Texts(TranslationBase.of(context).suggestion),
leading: Radio(
value: MessageType.Suggestion,
groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value),
),
),
),
)
],
),
SizedBox(
height: 5.0,
),
Divider(
height: 2.5,
color: Colors.grey[500],
),
SizedBox(
height: 5,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.pop(context);
},
child: Padding(
padding: EdgeInsets.all(8.0),
child: Container(
child: Center(
child: Texts(
TranslationBase.of(context).cancel,
color: CustomColors.accentColor,
),
),
),
),
),
),
Container(
width: 1,
height: 30,
color: Colors.grey[500],
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
widget.onValueSelected(messageTypeDialog);
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
TranslationBase.of(context).ok,
fontWeight: FontWeight.w400,
)),
),
)),
],
)
],
),
),
],
),
);
}
}
// todo 'sikander' remove useless code
// class FeedbackTypeDialog extends StatefulWidget {
// final Function(MessageType) onValueSelected;
// final MessageType messageTypeDialog;
//
// const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) : super(key: key);
//
// @override
// State createState() => new FeedbackTypeDialogState();
// }
//
// class FeedbackTypeDialogState extends State<FeedbackTypeDialog> {
// MessageType messageTypeDialog = MessageType.NON;
//
// setMessageDialogType(MessageType messageType) {
// setState(() {
// messageTypeDialog = messageType;
// });
// }
//
// @override
// void initState() {
// messageTypeDialog = widget.messageTypeDialog;
//
// super.initState();
// }
//
// Widget build(BuildContext context) {
// return BaseView<FeedbackViewModel>(
// builder: (_, model, widge) => SimpleDialog(
// title: Text(
// TranslationBase.of(context).messageType,
// textAlign: TextAlign.center,
// ),
// children: <Widget>[
// Container(
// // padding: const EdgeInsets.all(10.0),
// child: Column(
// children: <Widget>[
// Divider(
// height: 2.5,
// color: Colors.grey[500],
// ),
// Row(
// children: <Widget>[
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () => setMessageDialogType(MessageType.NON),
// child: ListTile(
// title: Texts(TranslationBase.of(context).notClassified),
// leading: Radio(
// value: MessageType.NON,
// groupValue: messageTypeDialog,
// activeColor: CustomColors.accentColor,
// onChanged: (MessageType value) => setMessageDialogType(value),
// ),
// ),
// ),
// )
// ],
// ),
// SizedBox(
// height: 5.0,
// ),
// Row(
// children: <Widget>[
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () => setMessageDialogType(MessageType.ComplaintOnAnAppointment),
// child: ListTile(
// title: Texts(TranslationBase.of(context).complainAppo),
// leading: Radio(
// value: MessageType.ComplaintOnAnAppointment,
// groupValue: messageTypeDialog,
// activeColor: CustomColors.accentColor,
// onChanged: (MessageType value) => setMessageDialogType(value),
// ),
// ),
// ),
// )
// ],
// ),
// SizedBox(
// height: 5.0,
// ),
// Row(
// children: <Widget>[
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () => setMessageDialogType(MessageType.ComplaintWithoutAppointment),
// child: ListTile(
// title: Texts(TranslationBase.of(context).complainWithoutAppo),
// leading: Radio(
// value: MessageType.ComplaintWithoutAppointment,
// groupValue: messageTypeDialog,
// activeColor: CustomColors.accentColor,
// onChanged: (MessageType value) => setMessageDialogType(value),
// ),
// ),
// ),
// )
// ],
// ),
// SizedBox(
// height: 5.0,
// ),
// Row(
// children: <Widget>[
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () => setMessageDialogType(MessageType.Question),
// child: ListTile(
// title: Texts(TranslationBase.of(context).question),
// leading: Radio(
// value: MessageType.Question,
// groupValue: messageTypeDialog,
// activeColor: CustomColors.accentColor,
// onChanged: (MessageType value) => setMessageDialogType(value),
// ),
// ),
// ),
// )
// ],
// ),
// SizedBox(
// height: 5.0,
// ),
// Row(
// children: <Widget>[
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () => setMessageDialogType(MessageType.Compliment),
// child: ListTile(
// title: Texts(TranslationBase.of(context).compliment),
// leading: Radio(
// value: MessageType.Compliment,
// groupValue: messageTypeDialog,
// activeColor: CustomColors.accentColor,
// onChanged: (MessageType value) => setMessageDialogType(value),
// ),
// ),
// ),
// )
// ],
// ),
// SizedBox(
// height: 5.0,
// ),
// Row(
// children: <Widget>[
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () => setMessageDialogType(MessageType.Suggestion),
// child: ListTile(
// title: Texts(TranslationBase.of(context).suggestion),
// leading: Radio(
// value: MessageType.Suggestion,
// groupValue: messageTypeDialog,
// activeColor: CustomColors.accentColor,
// onChanged: (MessageType value) => setMessageDialogType(value),
// ),
// ),
// ),
// )
// ],
// ),
// SizedBox(
// height: 5.0,
// ),
// Divider(
// height: 2.5,
// color: Colors.grey[500],
// ),
// SizedBox(
// height: 5,
// ),
// Row(
// // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: <Widget>[
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () {
// Navigator.pop(context);
// },
// child: Padding(
// padding: EdgeInsets.all(8.0),
// child: Container(
// child: Center(
// child: Texts(
// TranslationBase.of(context).cancel,
// color: CustomColors.accentColor,
// ),
// ),
// ),
// ),
// ),
// ),
// Container(
// width: 1,
// height: 30,
// color: Colors.grey[500],
// ),
// Expanded(
// flex: 1,
// child: InkWell(
// onTap: () {
// widget.onValueSelected(messageTypeDialog);
// Navigator.pop(context);
// },
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Center(
// child: Texts(
// TranslationBase.of(context).ok,
// fontWeight: FontWeight.w400,
// )),
// ),
// )),
// ],
// )
// ],
// ),
// ),
// ],
// ),
// );
// }
// }

@ -8,8 +8,10 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -35,12 +37,15 @@ class _AddWeightPageState extends State<AddWeightPage> {
TextEditingController _weightValueController = TextEditingController();
DateTime dayWeightDate = DateTime.now();
DateTime timeWeightDate = DateTime.now();
int weightUnit = 1;
int weightUnit = 0;
final List<String> measureUnitEnList = [
'Kg',
'Pound',
'Kg',
];
final List<String> measureUnitArList = [
"باوند",
"كيلو جرام",
];
final List<String> measureUnitArList = ["كيلو جرام", "باوند"];
String measureTimeSelectedType;
bool isButtonDisabled = true;
@ -52,9 +57,6 @@ class _AddWeightPageState extends State<AddWeightPage> {
timeWeightDate = widget.dayWeightDate;
measureTimeSelectedType = widget.measureTimeSelectedType;
weightUnit = widget.weightUnit;
// if (measureUnitEnList.contains(widget.measureTimeSelectedType))
// weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType);
// else if (measureUnitArList.contains(widget.measureTimeSelectedType)) weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType);
_weightValueController.text = widget.weightValue;
validateForm();
}
@ -65,19 +67,17 @@ class _AddWeightPageState extends State<AddWeightPage> {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true,
showNewAppBarTitle: true,
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.all(15),
child: Column(
isShowAppBar: true,
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true,
showNewAppBarTitle: true,
body: Column(
children: [
Expanded(
child: ListView(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
children: [
SizedBox(
height: 15,
),
NewTextFields(
hintText: TranslationBase.of(context).weightAdd,
controller: _weightValueController,
@ -86,12 +86,27 @@ class _AddWeightPageState extends State<AddWeightPage> {
fontWeight: FontWeight.normal,
fontSize: 14,
),
SizedBox(
height: 8,
),
SizedBox(height: 12),
InkWell(
onTap: () {
confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureUnitArList : measureUnitEnList);
List<RadioSelectionDialogModel> list = [
RadioSelectionDialogModel(projectViewModel.isArabic ? measureUnitArList[0] : measureUnitEnList[0], 0),
RadioSelectionDialogModel(projectViewModel.isArabic ? measureUnitArList[1] : measureUnitEnList[1], 1),
];
showDialog(
context: context,
child: RadioSelectionDialog(
listData: list,
selectedIndex: weightUnit,
onValueSelected: (index) {
weightUnit = index;
measureTimeSelectedType = list[index].title;
setState(() {});
validateForm();
},
),
);
},
child: Container(
padding: EdgeInsets.all(12),
@ -110,9 +125,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
),
),
),
SizedBox(
height: 8,
),
SizedBox(height: 12),
InkWell(
onTap: () {
DatePicker.showDatePicker(
@ -143,9 +156,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
),
),
),
SizedBox(
height: 8,
),
SizedBox(height: 12),
InkWell(
onTap: () {
DatePicker.showTimePicker(
@ -185,6 +196,28 @@ class _AddWeightPageState extends State<AddWeightPage> {
color: Colors.red[900],
),
onTap: () {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
message: TranslationBase.of(context).removeMeasure,
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
widget.model.deleteWeightResult(lineItemNo: widget.lineItemNo).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
},
),
);
return;
// todo 'sikander' remove useless code
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).removeMeasure,
@ -209,55 +242,58 @@ class _AddWeightPageState extends State<AddWeightPage> {
dialog.showAlertDialog(context);
})
],
))
),
)
: Container()
],
),
),
),
bottomSheet: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(20.0),
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: DefaultButton(
TranslationBase.of(context).save.toUpperCase(),
isButtonDisabled ? null : () async {
if (_weightValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
if (widget.isUpdate) {
widget.model
.updateWeightResult(
isButtonDisabled
? null
: () async {
if (_weightValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
if (widget.isUpdate) {
widget.model
.updateWeightResult(
weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured: _weightValueController.text.toString(),
weightUnit: weightUnit,
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.Error)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
});
} else
widget.model
.addWeightResult(
weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured: _weightValueController.text.toString(),
weightUnit: weightUnit + 1,
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.Error)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
});
} else
widget.model
.addWeightResult(
weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured: _weightValueController.text.toString(),
weightUnit: weightUnit,
)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.Error)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
});
}
},
weightUnit: weightUnit,
)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.Error)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
});
}
},
disabledColor: Colors.grey,
),
),
));
)
],
),
);
}
String getDate() {

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -40,13 +41,10 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
TextEditingController _bloodDiastolicValueController = TextEditingController();
DateTime bloodSugarDate = DateTime.now();
DateTime timeSugarDate = DateTime.now();
int measuredArm = 1;
int measuredArm = 0;
bool isButtonDisabled = true;
final List<String> measureTimeEnList = ['Right Arm', 'Left Arm'];
final List<String> measureTimeArList = [
'الذراع الأيمن',
'الذراع الأيسر',
];
final List<String> measureTimeEnList = ['Left Arm', 'Right Arm'];
final List<String> measureTimeArList = ['الذراع الأيسر', 'الذراع الأيمن'];
String measureTimeSelectedType = 'Left Arm';
@override
@ -56,7 +54,9 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
bloodSugarDate = widget.bloodSugarDate;
bloodSugarDate = widget.bloodSugarDate;
measureTimeSelectedType = widget.measureTimeSelectedType;
measuredArm = widget.measuredArm - 1;
measuredArm = widget.measuredArm;
if (measuredArm > 1) measuredArm = measuredArm - 1;
_bloodSystolicValueController.text = widget.bloodSystolicValue;
_bloodDiastolicValueController.text = widget.bloodDiastolicValue;
validateForm();
@ -68,19 +68,17 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true,
showNewAppBarTitle: true,
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.all(15),
child: Column(
isShowAppBar: true,
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true,
showNewAppBarTitle: true,
body: Column(
children: [
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.all(21),
children: [
SizedBox(
height: 15,
),
NewTextFields(
hintText: TranslationBase.of(context).systolicAdd,
controller: _bloodSystolicValueController,
@ -90,9 +88,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
fontWeight: FontWeight.normal,
fontSize: 14,
),
SizedBox(
height: 8,
),
SizedBox(height: 12),
NewTextFields(
hintText: TranslationBase.of(context).diastolicAdd,
controller: _bloodDiastolicValueController,
@ -102,11 +98,29 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
fontWeight: FontWeight.normal,
fontSize: 14,
),
SizedBox(
height: 8,
),
SizedBox(height: 12),
InkWell(
onTap: () {
List<RadioSelectionDialogModel> list = [
RadioSelectionDialogModel(projectViewModel.isArabic ? measureTimeArList[0] : measureTimeEnList[0], 0),
RadioSelectionDialogModel(projectViewModel.isArabic ? measureTimeArList[1] : measureTimeEnList[1], 1),
];
showDialog(
context: context,
child: RadioSelectionDialog(
listData: list,
selectedIndex: measuredArm,
onValueSelected: (index) {
measuredArm = index;
measureTimeSelectedType = list[index].title;
setState(() {});
validateForm();
},
),
);
return;
confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList);
},
child: Container(
@ -126,9 +140,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
),
),
),
SizedBox(
height: 8,
),
SizedBox(height: 12),
InkWell(
onTap: () {
DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) {
@ -153,9 +165,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
),
),
),
SizedBox(
height: 8,
),
SizedBox(height: 12),
InkWell(
onTap: () {
DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) {
@ -220,41 +230,43 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
],
),
),
),
bottomSheet: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(20.0),
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: DefaultButton(
TranslationBase.of(context).save,
isButtonDisabled ? null : () async {
if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.addORUpdateDiabtecResult(
isUpdate: widget.isUpdate,
bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
diastolicPressure: _bloodDiastolicValueController.text.toString(),
systolicePressure: _bloodSystolicValueController.text.toString(),
measuredArm: (measuredArm + 1),
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.BusyLocal)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
;
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
}
},
isButtonDisabled
? null
: () async {
if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.addORUpdateDiabtecResult(
isUpdate: widget.isUpdate,
bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
diastolicPressure: _bloodDiastolicValueController.text.toString(),
systolicePressure: _bloodSystolicValueController.text.toString(),
measuredArm: (measuredArm),
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.BusyLocal)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
;
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
}
},
disabledColor: Colors.grey,
),
),
));
)
],
),
);
}
String getDate() {

@ -44,113 +44,101 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<BloodPressureViewMode>(
onModelReady: (model) => model.getBloodPressure(),
builder: (_, model, w) =>
AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase
.of(context)
.bloodPressure,
showNewAppBar: true,
showNewAppBarTitle: true,
baseViewModel: model,
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: TabBarWidget(
tabController: _tabController,
),
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
BloodPressureWeeklyPage(
model: model,
),
BloodPressureMonthlyPage(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).bloodPressure,
showNewAppBar: true,
showNewAppBarTitle: true,
baseViewModel: model,
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: TabBarWidget(
tabController: _tabController,
),
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
BloodPressureWeeklyPage(
model: model,
),
BloodPressureMonthlyPage(
model: model,
),
BloodPressureYearPage(
model: model,
)
],
),
)
],
),
floatingActionButton: Stack(children: [
Positioned(
bottom: 60,
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: AddBloodPressurePage(
model: model,
))).then((value) {
model.getBloodPressure();
});
},
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
child: Center(
child: Icon(
Icons.add,
color: Colors.white,
),
BloodPressureYearPage(
model: model,
)
],
),
)
],
),
floatingActionButton: Stack(children: [
Positioned(
bottom: 60,
right: projectViewModel.isArabic ? MediaQuery
.of(context)
.size
.width * .85 : 0,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: AddBloodPressurePage(
model: model,
))).then((value) {
model.getBloodPressure();
)),
))
]),
bottomSheet: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: DefaultButton(
TranslationBase.of(context).sendEmail,
() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async {
GifLoaderDialogUtils.showMyDialog(context);
model.sendReportByEmail().then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
AppToast.showErrorToast(message: model.error);
} else {
AppToast.showSuccessToast(
message: TranslationBase.of(context).emailSentSuccessfully,
);
}
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: model.error);
});
},
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme
.of(context)
.primaryColor),
child: Center(
child: Icon(
Icons.add,
color: Colors.white,
),
)),
))
]),
bottomSheet: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: DefaultButton(
TranslationBase
.of(context)
.sendEmail,
() {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: model.user.emailAddress,
onTapSendEmail: () async {
GifLoaderDialogUtils.showMyDialog(context);
model.sendReportByEmail().then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
AppToast.showErrorToast(message: model.error);
} else {
AppToast.showSuccessToast(
message: TranslationBase
.of(context)
.emailSentSuccessfully,
);
}
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: model.error);
});
},
),
);
},
// label: TranslationBase.of(context).sendEmail,
// backgroundColor: Colors.red[900],
),
),
),
);
},
// label: TranslationBase.of(context).sendEmail,
// backgroundColor: Colors.red[900],
),
)),
),
),
)),
);
}
}

@ -26,7 +26,8 @@ class AddBloodSugarPage extends StatefulWidget {
final String measuredSelectedType;
final BloodSugarViewMode bloodSugarViewMode;
AddBloodSugarPage({Key key, this.bloodSugarDate, this.measureUnitSelectedType, this.isUpdate = false, this.measuredTime, this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode, this.measuredSelectedType})
AddBloodSugarPage(
{Key key, this.bloodSugarDate, this.measureUnitSelectedType, this.isUpdate = false, this.measuredTime, this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode, this.measuredSelectedType})
: super(key: key);
@override

@ -225,31 +225,33 @@ class SMSOTP {
});
}
static void showLoadingDialog(BuildContext context, bool _loading) async {
_context = context;
//setSignature();
if (_loading == false) {
Navigator.of(context).pop();
return;
}
_loading = true;
await showDialog(
context: _context,
barrierDismissible: false,
builder: (BuildContext context) {
return SimpleDialog(
elevation: 0.0,
backgroundColor: Colors.transparent,
children: <Widget>[
Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.black),
),
)
],
);
});
}
// todo 'sikander' remove useless code
// static void showLoadingDialog(BuildContext context, bool _loading) async {
// _context = context;
// //setSignature();
// if (_loading == false) {
// Navigator.of(context).pop();
// return;
// }
// _loading = true;
// await showDialog(
// context: _context,
// barrierDismissible: false,
// builder: (BuildContext context) {
// return SimpleDialog(
// elevation: 0.0,
// backgroundColor: Colors.transparent,
// children: <Widget>[
// Center(
// child: CircularProgressIndicator(
// valueColor: AlwaysStoppedAnimation<Color>(Colors.black),
// ),
// )
// ],
// );
// });
// }
static void hideSMSBox(context) {
Navigator.pop(context);

Loading…
Cancel
Save