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

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

@ -499,41 +499,41 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
return; return;
// todo 'sikander' remove useless code // todo 'sikander' remove useless code
showDialog( // showDialog(
context: context, // context: context,
child: FeedbackTypeDialog( // child: FeedbackTypeDialog(
messageTypeDialog: messageType, // messageTypeDialog: messageType,
onValueSelected: (MessageType value) { // onValueSelected: (MessageType value) {
if (value == MessageType.ComplaintOnAnAppointment) { // if (value == MessageType.ComplaintOnAnAppointment) {
appoList.clear(); // appoList.clear();
GifLoaderDialogUtils.showMyDialog(context); // GifLoaderDialogUtils.showMyDialog(context);
service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) { // service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) {
GifLoaderDialogUtils.hideDialog(context); // GifLoaderDialogUtils.hideDialog(context);
setState(() { // setState(() {
if (res['MessageStatus'] == 1) { // if (res['MessageStatus'] == 1) {
if (res['AppoimentAllHistoryResultList'].length != 0) { // if (res['AppoimentAllHistoryResultList'].length != 0) {
res['AppoimentAllHistoryResultList'].forEach((v) { // res['AppoimentAllHistoryResultList'].forEach((v) {
appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); // appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
}); // });
setState(() { // setState(() {
appointHistory = null; // appointHistory = null;
isShowListAppointHistory = true; // isShowListAppointHistory = true;
}); // });
} else {} // } else {}
} else {} // } else {}
}); // });
}).catchError((err) { // }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); // GifLoaderDialogUtils.hideDialog(context);
// print(err); // // print(err);
// AppToast.showErrorToast(message: err); // // AppToast.showErrorToast(message: err);
// Navigator.of(context).pop(); // // Navigator.of(context).pop();
}); // });
} else { // } else {
isShowListAppointHistory = false; // isShowListAppointHistory = false;
} // }
setMessageType(value); // setMessageType(value);
}, // },
)); // ));
} }
openSpeechReco() async { openSpeechReco() async {
@ -587,238 +587,238 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
if (!mounted) return; if (!mounted) return;
} }
} }
// todo 'sikander' remove useless code
class FeedbackTypeDialog extends StatefulWidget { // class FeedbackTypeDialog extends StatefulWidget {
final Function(MessageType) onValueSelected; // final Function(MessageType) onValueSelected;
final MessageType messageTypeDialog; // final MessageType messageTypeDialog;
//
const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) : super(key: key); // const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) : super(key: key);
//
@override // @override
State createState() => new FeedbackTypeDialogState(); // State createState() => new FeedbackTypeDialogState();
} // }
//
class FeedbackTypeDialogState extends State<FeedbackTypeDialog> { // class FeedbackTypeDialogState extends State<FeedbackTypeDialog> {
MessageType messageTypeDialog = MessageType.NON; // MessageType messageTypeDialog = MessageType.NON;
//
setMessageDialogType(MessageType messageType) { // setMessageDialogType(MessageType messageType) {
setState(() { // setState(() {
messageTypeDialog = messageType; // messageTypeDialog = messageType;
}); // });
} // }
//
@override // @override
void initState() { // void initState() {
messageTypeDialog = widget.messageTypeDialog; // messageTypeDialog = widget.messageTypeDialog;
//
super.initState(); // super.initState();
} // }
//
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return BaseView<FeedbackViewModel>( // return BaseView<FeedbackViewModel>(
builder: (_, model, widge) => SimpleDialog( // builder: (_, model, widge) => SimpleDialog(
title: Text( // title: Text(
TranslationBase.of(context).messageType, // TranslationBase.of(context).messageType,
textAlign: TextAlign.center, // textAlign: TextAlign.center,
), // ),
children: <Widget>[ // children: <Widget>[
Container( // Container(
// padding: const EdgeInsets.all(10.0), // // padding: const EdgeInsets.all(10.0),
child: Column( // child: Column(
children: <Widget>[ // children: <Widget>[
Divider( // Divider(
height: 2.5, // height: 2.5,
color: Colors.grey[500], // color: Colors.grey[500],
), // ),
Row( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () => setMessageDialogType(MessageType.NON), // onTap: () => setMessageDialogType(MessageType.NON),
child: ListTile( // child: ListTile(
title: Texts(TranslationBase.of(context).notClassified), // title: Texts(TranslationBase.of(context).notClassified),
leading: Radio( // leading: Radio(
value: MessageType.NON, // value: MessageType.NON,
groupValue: messageTypeDialog, // groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor, // activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value), // onChanged: (MessageType value) => setMessageDialogType(value),
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
SizedBox( // SizedBox(
height: 5.0, // height: 5.0,
), // ),
Row( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () => setMessageDialogType(MessageType.ComplaintOnAnAppointment), // onTap: () => setMessageDialogType(MessageType.ComplaintOnAnAppointment),
child: ListTile( // child: ListTile(
title: Texts(TranslationBase.of(context).complainAppo), // title: Texts(TranslationBase.of(context).complainAppo),
leading: Radio( // leading: Radio(
value: MessageType.ComplaintOnAnAppointment, // value: MessageType.ComplaintOnAnAppointment,
groupValue: messageTypeDialog, // groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor, // activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value), // onChanged: (MessageType value) => setMessageDialogType(value),
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
SizedBox( // SizedBox(
height: 5.0, // height: 5.0,
), // ),
Row( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () => setMessageDialogType(MessageType.ComplaintWithoutAppointment), // onTap: () => setMessageDialogType(MessageType.ComplaintWithoutAppointment),
child: ListTile( // child: ListTile(
title: Texts(TranslationBase.of(context).complainWithoutAppo), // title: Texts(TranslationBase.of(context).complainWithoutAppo),
leading: Radio( // leading: Radio(
value: MessageType.ComplaintWithoutAppointment, // value: MessageType.ComplaintWithoutAppointment,
groupValue: messageTypeDialog, // groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor, // activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value), // onChanged: (MessageType value) => setMessageDialogType(value),
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
SizedBox( // SizedBox(
height: 5.0, // height: 5.0,
), // ),
Row( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () => setMessageDialogType(MessageType.Question), // onTap: () => setMessageDialogType(MessageType.Question),
child: ListTile( // child: ListTile(
title: Texts(TranslationBase.of(context).question), // title: Texts(TranslationBase.of(context).question),
leading: Radio( // leading: Radio(
value: MessageType.Question, // value: MessageType.Question,
groupValue: messageTypeDialog, // groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor, // activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value), // onChanged: (MessageType value) => setMessageDialogType(value),
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
SizedBox( // SizedBox(
height: 5.0, // height: 5.0,
), // ),
Row( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () => setMessageDialogType(MessageType.Compliment), // onTap: () => setMessageDialogType(MessageType.Compliment),
child: ListTile( // child: ListTile(
title: Texts(TranslationBase.of(context).compliment), // title: Texts(TranslationBase.of(context).compliment),
leading: Radio( // leading: Radio(
value: MessageType.Compliment, // value: MessageType.Compliment,
groupValue: messageTypeDialog, // groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor, // activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value), // onChanged: (MessageType value) => setMessageDialogType(value),
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
SizedBox( // SizedBox(
height: 5.0, // height: 5.0,
), // ),
Row( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () => setMessageDialogType(MessageType.Suggestion), // onTap: () => setMessageDialogType(MessageType.Suggestion),
child: ListTile( // child: ListTile(
title: Texts(TranslationBase.of(context).suggestion), // title: Texts(TranslationBase.of(context).suggestion),
leading: Radio( // leading: Radio(
value: MessageType.Suggestion, // value: MessageType.Suggestion,
groupValue: messageTypeDialog, // groupValue: messageTypeDialog,
activeColor: CustomColors.accentColor, // activeColor: CustomColors.accentColor,
onChanged: (MessageType value) => setMessageDialogType(value), // onChanged: (MessageType value) => setMessageDialogType(value),
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
SizedBox( // SizedBox(
height: 5.0, // height: 5.0,
), // ),
Divider( // Divider(
height: 2.5, // height: 2.5,
color: Colors.grey[500], // color: Colors.grey[500],
), // ),
SizedBox( // SizedBox(
height: 5, // height: 5,
), // ),
Row( // Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () { // onTap: () {
Navigator.pop(context); // Navigator.pop(context);
}, // },
child: Padding( // child: Padding(
padding: EdgeInsets.all(8.0), // padding: EdgeInsets.all(8.0),
child: Container( // child: Container(
child: Center( // child: Center(
child: Texts( // child: Texts(
TranslationBase.of(context).cancel, // TranslationBase.of(context).cancel,
color: CustomColors.accentColor, // color: CustomColors.accentColor,
), // ),
), // ),
), // ),
), // ),
), // ),
), // ),
Container( // Container(
width: 1, // width: 1,
height: 30, // height: 30,
color: Colors.grey[500], // color: Colors.grey[500],
), // ),
Expanded( // Expanded(
flex: 1, // flex: 1,
child: InkWell( // child: InkWell(
onTap: () { // onTap: () {
widget.onValueSelected(messageTypeDialog); // widget.onValueSelected(messageTypeDialog);
Navigator.pop(context); // Navigator.pop(context);
}, // },
child: Padding( // child: Padding(
padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
child: Center( // child: Center(
child: Texts( // child: Texts(
TranslationBase.of(context).ok, // TranslationBase.of(context).ok,
fontWeight: FontWeight.w400, // 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/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.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/RadioStringDialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -35,12 +37,15 @@ class _AddWeightPageState extends State<AddWeightPage> {
TextEditingController _weightValueController = TextEditingController(); TextEditingController _weightValueController = TextEditingController();
DateTime dayWeightDate = DateTime.now(); DateTime dayWeightDate = DateTime.now();
DateTime timeWeightDate = DateTime.now(); DateTime timeWeightDate = DateTime.now();
int weightUnit = 1; int weightUnit = 0;
final List<String> measureUnitEnList = [ final List<String> measureUnitEnList = [
'Kg',
'Pound', 'Pound',
'Kg',
];
final List<String> measureUnitArList = [
"باوند",
"كيلو جرام",
]; ];
final List<String> measureUnitArList = ["كيلو جرام", "باوند"];
String measureTimeSelectedType; String measureTimeSelectedType;
bool isButtonDisabled = true; bool isButtonDisabled = true;
@ -52,9 +57,6 @@ class _AddWeightPageState extends State<AddWeightPage> {
timeWeightDate = widget.dayWeightDate; timeWeightDate = widget.dayWeightDate;
measureTimeSelectedType = widget.measureTimeSelectedType; measureTimeSelectedType = widget.measureTimeSelectedType;
weightUnit = widget.weightUnit; 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; _weightValueController.text = widget.weightValue;
validateForm(); validateForm();
} }
@ -65,19 +67,17 @@ class _AddWeightPageState extends State<AddWeightPage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
body: SingleChildScrollView( body: Column(
physics: BouncingScrollPhysics(), children: [
child: Container( Expanded(
margin: EdgeInsets.all(15), child: ListView(
child: Column( padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
children: [ children: [
SizedBox(
height: 15,
),
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).weightAdd, hintText: TranslationBase.of(context).weightAdd,
controller: _weightValueController, controller: _weightValueController,
@ -86,12 +86,27 @@ class _AddWeightPageState extends State<AddWeightPage> {
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 14, fontSize: 14,
), ),
SizedBox( SizedBox(height: 12),
height: 8,
),
InkWell( InkWell(
onTap: () { 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( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
@ -110,9 +125,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
), ),
), ),
), ),
SizedBox( SizedBox(height: 12),
height: 8,
),
InkWell( InkWell(
onTap: () { onTap: () {
DatePicker.showDatePicker( DatePicker.showDatePicker(
@ -143,9 +156,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
), ),
), ),
), ),
SizedBox( SizedBox(height: 12),
height: 8,
),
InkWell( InkWell(
onTap: () { onTap: () {
DatePicker.showTimePicker( DatePicker.showTimePicker(
@ -185,6 +196,28 @@ class _AddWeightPageState extends State<AddWeightPage> {
color: Colors.red[900], color: Colors.red[900],
), ),
onTap: () { 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( ConfirmDialog dialog = new ConfirmDialog(
context: context, context: context,
confirmMessage: TranslationBase.of(context).removeMeasure, confirmMessage: TranslationBase.of(context).removeMeasure,
@ -209,55 +242,58 @@ class _AddWeightPageState extends State<AddWeightPage> {
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
}) })
], ],
)) ),
)
: Container() : Container()
], ],
), ),
), ),
), Container(
bottomSheet: Container( color: Colors.white,
color: Theme.of(context).scaffoldBackgroundColor, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).save.toUpperCase(), TranslationBase.of(context).save.toUpperCase(),
isButtonDisabled ? null : () async { isButtonDisabled
if (_weightValueController.text.isNotEmpty) { ? null
GifLoaderDialogUtils.showMyDialog(context); : () async {
if (widget.isUpdate) { if (_weightValueController.text.isNotEmpty) {
widget.model GifLoaderDialogUtils.showMyDialog(context);
.updateWeightResult( 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', weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured: _weightValueController.text.toString(), weightMeasured: _weightValueController.text.toString(),
weightUnit: weightUnit + 1, weightUnit: weightUnit,
lineItemNo: widget.lineItemNo) )
.then((value) { .then((value) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.Error) if (widget.model.state == ViewState.Error)
AppToast.showErrorToast(message: widget.model.error); AppToast.showErrorToast(message: widget.model.error);
else else
Navigator.pop(context); 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);
});
}
},
disabledColor: Colors.grey, disabledColor: Colors.grey,
), ),
), )
)); ],
),
);
} }
String getDate() { 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/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -40,13 +41,10 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
TextEditingController _bloodDiastolicValueController = TextEditingController(); TextEditingController _bloodDiastolicValueController = TextEditingController();
DateTime bloodSugarDate = DateTime.now(); DateTime bloodSugarDate = DateTime.now();
DateTime timeSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now();
int measuredArm = 1; int measuredArm = 0;
bool isButtonDisabled = true; bool isButtonDisabled = true;
final List<String> measureTimeEnList = ['Right Arm', 'Left Arm']; final List<String> measureTimeEnList = ['Left Arm', 'Right Arm'];
final List<String> measureTimeArList = [ final List<String> measureTimeArList = ['الذراع الأيسر', 'الذراع الأيمن'];
'الذراع الأيمن',
'الذراع الأيسر',
];
String measureTimeSelectedType = 'Left Arm'; String measureTimeSelectedType = 'Left Arm';
@override @override
@ -56,7 +54,9 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
bloodSugarDate = widget.bloodSugarDate; bloodSugarDate = widget.bloodSugarDate;
bloodSugarDate = widget.bloodSugarDate; bloodSugarDate = widget.bloodSugarDate;
measureTimeSelectedType = widget.measureTimeSelectedType; measureTimeSelectedType = widget.measureTimeSelectedType;
measuredArm = widget.measuredArm - 1; measuredArm = widget.measuredArm;
if (measuredArm > 1) measuredArm = measuredArm - 1;
_bloodSystolicValueController.text = widget.bloodSystolicValue; _bloodSystolicValueController.text = widget.bloodSystolicValue;
_bloodDiastolicValueController.text = widget.bloodDiastolicValue; _bloodDiastolicValueController.text = widget.bloodDiastolicValue;
validateForm(); validateForm();
@ -68,19 +68,17 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
body: SingleChildScrollView( body: Column(
physics: BouncingScrollPhysics(), children: [
child: Container( Expanded(
margin: EdgeInsets.all(15), child: ListView(
child: Column( physics: BouncingScrollPhysics(),
padding: EdgeInsets.all(21),
children: [ children: [
SizedBox(
height: 15,
),
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).systolicAdd, hintText: TranslationBase.of(context).systolicAdd,
controller: _bloodSystolicValueController, controller: _bloodSystolicValueController,
@ -90,9 +88,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 14, fontSize: 14,
), ),
SizedBox( SizedBox(height: 12),
height: 8,
),
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).diastolicAdd, hintText: TranslationBase.of(context).diastolicAdd,
controller: _bloodDiastolicValueController, controller: _bloodDiastolicValueController,
@ -102,11 +98,29 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 14, fontSize: 14,
), ),
SizedBox( SizedBox(height: 12),
height: 8,
),
InkWell( InkWell(
onTap: () { 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); confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList);
}, },
child: Container( child: Container(
@ -126,9 +140,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
), ),
), ),
), ),
SizedBox( SizedBox(height: 12),
height: 8,
),
InkWell( InkWell(
onTap: () { onTap: () {
DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { 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( SizedBox(height: 12),
height: 8,
),
InkWell( InkWell(
onTap: () { onTap: () {
DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) {
@ -220,41 +230,43 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
], ],
), ),
), ),
), Container(
bottomSheet: Container( color: Colors.white,
color: Theme.of(context).scaffoldBackgroundColor, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).save, TranslationBase.of(context).save,
isButtonDisabled ? null : () async { isButtonDisabled
if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) { ? null
GifLoaderDialogUtils.showMyDialog(context); : () async {
widget.model if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) {
.addORUpdateDiabtecResult( GifLoaderDialogUtils.showMyDialog(context);
isUpdate: widget.isUpdate, widget.model
bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', .addORUpdateDiabtecResult(
diastolicPressure: _bloodDiastolicValueController.text.toString(), isUpdate: widget.isUpdate,
systolicePressure: _bloodSystolicValueController.text.toString(), bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
measuredArm: (measuredArm + 1), diastolicPressure: _bloodDiastolicValueController.text.toString(),
lineItemNo: widget.lineItemNo) systolicePressure: _bloodSystolicValueController.text.toString(),
.then((value) { measuredArm: (measuredArm),
GifLoaderDialogUtils.hideDialog(context); lineItemNo: widget.lineItemNo)
if (widget.model.state == ViewState.BusyLocal) .then((value) {
AppToast.showErrorToast(message: widget.model.error); GifLoaderDialogUtils.hideDialog(context);
else if (widget.model.state == ViewState.BusyLocal)
Navigator.pop(context); AppToast.showErrorToast(message: widget.model.error);
; else
}).catchError((e) { Navigator.pop(context);
GifLoaderDialogUtils.hideDialog(context); ;
AppToast.showErrorToast(message: widget.model.error); }).catchError((e) {
}); GifLoaderDialogUtils.hideDialog(context);
} AppToast.showErrorToast(message: widget.model.error);
}, });
}
},
disabledColor: Colors.grey, disabledColor: Colors.grey,
), ),
), )
)); ],
),
);
} }
String getDate() { String getDate() {

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

@ -26,7 +26,8 @@ class AddBloodSugarPage extends StatefulWidget {
final String measuredSelectedType; final String measuredSelectedType;
final BloodSugarViewMode bloodSugarViewMode; 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); : super(key: key);
@override @override

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

Loading…
Cancel
Save