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

merge-requests/443/merge
Sikander Saleem 5 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,7 +70,8 @@ class OrdersLogDetailsPage extends StatelessWidget {
return AppScaffold(
isShowAppBar: false,
baseViewModel: model,
body: model.hhcAllPresOrders.length > 0 ? ListView.separated(
body: model.hhcAllPresOrders.length > 0
? ListView.separated(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
@ -170,7 +192,8 @@ class OrdersLogDetailsPage extends StatelessWidget {
);
},
separatorBuilder: (context, index) => SizedBox(height: 12),
itemCount: model.hhcAllPresOrders.length) : getNoDataWidget(context),
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();
}
@ -69,15 +71,13 @@ class _AddWeightPageState extends State<AddWeightPage> {
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true,
showNewAppBarTitle: true,
body: SingleChildScrollView(
body: Column(
children: [
Expanded(
child: ListView(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.all(15),
child: Column(
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,19 +242,20 @@ 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 {
isButtonDisabled
? null
: () async {
if (_weightValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
if (widget.isUpdate) {
@ -229,7 +263,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
.updateWeightResult(
weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured: _weightValueController.text.toString(),
weightUnit: weightUnit + 1,
weightUnit: weightUnit,
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
@ -256,8 +290,10 @@ class _AddWeightPageState extends State<AddWeightPage> {
},
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();
@ -72,15 +72,13 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true,
showNewAppBarTitle: true,
body: SingleChildScrollView(
body: Column(
children: [
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.all(15),
child: Column(
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,14 +230,14 @@ 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 {
isButtonDisabled
? null
: () async {
if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
widget.model
@ -236,7 +246,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
diastolicPressure: _bloodDiastolicValueController.text.toString(),
systolicePressure: _bloodSystolicValueController.text.toString(),
measuredArm: (measuredArm + 1),
measuredArm: (measuredArm),
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
@ -253,8 +263,10 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
},
disabledColor: Colors.grey,
),
)
],
),
));
);
}
String getDate() {

@ -44,12 +44,9 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<BloodPressureViewMode>(
onModelReady: (model) => model.getBloodPressure(),
builder: (_, model, w) =>
AppScaffold(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase
.of(context)
.bloodPressure,
appBarTitle: TranslationBase.of(context).bloodPressure,
showNewAppBar: true,
showNewAppBarTitle: true,
baseViewModel: model,
@ -82,10 +79,7 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
floatingActionButton: Stack(children: [
Positioned(
bottom: 60,
right: projectViewModel.isArabic ? MediaQuery
.of(context)
.size
.width * .85 : 0,
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0,
child: InkWell(
onTap: () {
Navigator.push(
@ -100,9 +94,7 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme
.of(context)
.primaryColor),
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
child: Center(
child: Icon(
Icons.add,
@ -116,9 +108,7 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
child: Padding(
padding: const EdgeInsets.all(12.0),
child: DefaultButton(
TranslationBase
.of(context)
.sendEmail,
TranslationBase.of(context).sendEmail,
() {
showDialog(
context: context,
@ -132,9 +122,7 @@ class _BloodPressureHomePageState extends State<BloodPressureHomePage> with Sing
AppToast.showErrorToast(message: model.error);
} else {
AppToast.showSuccessToast(
message: TranslationBase
.of(context)
.emailSentSuccessfully,
message: TranslationBase.of(context).emailSentSuccessfully,
);
}
}).catchError((e) {

@ -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