diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index a5c89c17..d3c7f970 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -51,36 +51,6 @@ class OrdersLogDetailsPage extends StatelessWidget { }, )); return; - - // todo 'sikander' remove useless code - showDialog( - context: context, - child: ConfirmCancelOrderDialog( - model: model, - onTap: () async { - 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); - } - }); - // await model.updateCmcPresOrder(updatePresOrderRequestModel); - // if (model.state == ViewState.ErrorLocal) { - // Utils.showErrorToast(model.error); - // } else { - // AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - // await model.getCmcAllPresOrders(); - // } - }, - ), - ); } return AppScaffold( diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index b401a127..f8e377b7 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -95,7 +95,7 @@ class _NewHomeHealthCareStepOnePageState extends State with Tick ProjectViewModel projectViewModel = Provider.of(context); - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.8, - child: Column( - children: [ - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - widget.model.pendingOrder != null - ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ - (Container( - decoration: BoxDecoration( - color: Color(0xffCC9B14), - borderRadius: BorderRadius.all( - Radius.circular(10.0), + return PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + widget.model.pendingOrder != null + ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ + (Container( + decoration: BoxDecoration( + color: Color(0xffCC9B14), + 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), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.model.pendingOrder.statusText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', + 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).serviceName + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), + Column( + children: [ + ...List.generate( + widget.model.hhcAllOrderDetail.length, + (index) => Container( + child: Texts( + projectViewModel.isArabic + ? widget.model.hhcAllOrderDetail[index].descriptionN + : widget.model.hhcAllOrderDetail[index].description.capitalize(), + fontSize: 13, + bold: false, + ), + ), + ) + ], + ) + ], + ) + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.createdOn)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.model, widget.model.pendingOrder); + }, 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), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), decoration: BoxDecoration( - color: Colors.white, + color: Color(0xffD02127), 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), - ), + borderRadius: BorderRadius.circular(10), ), - // clipBehavior: Clip.antiAlias, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.model.pendingOrder.statusText, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), - ), - SizedBox(height: 6), - Text( - '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', - 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).serviceName + ": ", - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), - ), - Column( - children: [ - ...List.generate( - widget.model.hhcAllOrderDetail.length, - (index) => Container( - child: Texts( - projectViewModel.isArabic - ? widget.model.hhcAllOrderDetail[index].descriptionN - : widget.model.hhcAllOrderDetail[index].description.capitalize(), - fontSize: 13, - bold: false, - ), - ), - ) - ], - ) - ], - ) - ], - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), - ), - SizedBox(height: 12), - if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) - InkWell( - onTap: () { - showConfirmMessage(widget.model, widget.model.pendingOrder); - }, - 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), - ), - ), - ), - ], - ), - ], + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), - )) - ]) - - // FractionallySizedBox( - // widthFactor: 0.9, - // child: SingleChildScrollView( - // child: Container( - // // margin: EdgeInsets.all(10), - // child: Container( - // width: double.infinity, - // padding: EdgeInsets.only(left: 12, right: 12, top: 12), - // child: Card( - // shape: cardRadius(12), - // elevation: 2, - // margin: EdgeInsets.zero, - // color: Color(0xffcd9e1b), - // clipBehavior: Clip.antiAlias, - // child: Container( - // // decoration: containerColorRadiusLeft(Colors.white, 12), - // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), - // padding: EdgeInsets.all(12), - // // color: Colors.white, - // decoration: BoxDecoration( - // shape: BoxShape.rectangle, - // color: Colors.white, - // borderRadius: BorderRadius.only( - // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - // ), - // ), - // // clipBehavior: Clip.antiAlias, - // child: Row( - // children: [ - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts( - // TranslationBase.of(context).OrderStatus + - // ' ' + - // (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), - // bold: false, - // fontSize: 12, - // color: Color(0xffcd9e1b), - // fontWeight: FontWeight.bold, - // ), - // Texts( - // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), - // fontWeight: FontWeight.w600, - // fontSize: 18, - // ), - // Texts( - // TranslationBase.of(context).serviceName, - // fontSize: 12, - // fontWeight: FontWeight.w600, - // ), - // ...List.generate( - // widget.model.hhcAllOrderDetail.length, - // (index) => Container( - // child: Texts( - // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), - // fontSize: 13, - // bold: false, - // ), - // ), - // ), - // ], - // )), - // Column( - // children: [ - // Texts( - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), - // fontSize: 14, - // ), - // mHeight(8), - // // SecondaryButton( - // // onTap: () { - // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - // // }, - // // label: TranslationBase.of(context).cancel, - // // color: Colors.red[900], - // // small: true, - // // ) - // ], - // ), - // ], - // ))), - // )))) - : NewHomeHealthCareStepOnePage( - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, - model: widget.model, - ), - ], + ), + ], + ), + ], + ), ), - ), - ], - ), - ), - ), - ), + )) + ]) + + // FractionallySizedBox( + // widthFactor: 0.9, + // child: SingleChildScrollView( + // child: Container( + // // margin: EdgeInsets.all(10), + // child: Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 12, right: 12, top: 12), + // child: Card( + // shape: cardRadius(12), + // elevation: 2, + // margin: EdgeInsets.zero, + // color: Color(0xffcd9e1b), + // clipBehavior: Clip.antiAlias, + // child: Container( + // // decoration: containerColorRadiusLeft(Colors.white, 12), + // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), + // padding: EdgeInsets.all(12), + // // color: Colors.white, + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // color: Colors.white, + // borderRadius: BorderRadius.only( + // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // ), + // ), + // // clipBehavior: Clip.antiAlias, + // child: Row( + // children: [ + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).OrderStatus + + // ' ' + + // (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + // bold: false, + // fontSize: 12, + // color: Color(0xffcd9e1b), + // fontWeight: FontWeight.bold, + // ), + // Texts( + // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + // fontWeight: FontWeight.w600, + // fontSize: 18, + // ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // fontWeight: FontWeight.w600, + // ), + // ...List.generate( + // widget.model.hhcAllOrderDetail.length, + // (index) => Container( + // child: Texts( + // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), + // fontSize: 13, + // bold: false, + // ), + // ), + // ), + // ], + // )), + // Column( + // children: [ + // Texts( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + // fontSize: 14, + // ), + // mHeight(8), + // // SecondaryButton( + // // onTap: () { + // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + // // }, + // // label: TranslationBase.of(context).cancel, + // // color: Colors.red[900], + // // small: true, + // // ) + // ], + // ), + // ], + // ))), + // )))) + : NewHomeHealthCareStepOnePage( + changePageViewIndex: _changeCurrentTab, + patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + model: widget.model, + ), + ], ); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index 22ffd68f..e14d07e8 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -45,27 +45,6 @@ class OrdersLogDetailsPage extends StatelessWidget { ), ); return; - - // todo 'sikander' remove useless code - - showDialog( - context: context, - child: ConfirmCancelOrderDialog( - model: model, - 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 AppScaffold( diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart deleted file mode 100644 index 0197873b..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// todo 'sikander' remove useless code -// ignore: must_be_immutable -// class ConfirmAddAmountDialog extends StatefulWidget { -// final int amount; -// final String unit; -// final H2OViewModel model; -// -// ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"}); -// -// @override -// _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); -// } -// -// class _ConfirmAddAmountDialogState extends State { -// @override -// void initState() { -// super.initState(); -// } -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 8.0), -// titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0), -// title: Center( -// child: Texts( -// TranslationBase.of(context).confirm, -// textAlign: TextAlign.center, -// color: Colors.black, -// ), -// ), -// children: [ -// Column( -// children: [ -// Divider(), -// Center( -// child: Texts( -// "${TranslationBase.of(context).areyousure} ${widget.amount} ${widget.unit} ?", -// textAlign: TextAlign.center, -// color: Colors.grey, -// ), -// ), -// SizedBox( -// height: 16.0, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).cancel.toUpperCase(), -// color: Colors.red, -// ), -// ), -// ), -// ), -// ), -// ), -// Container( -// width: 1, -// height: 30, -// color: Colors.grey[500], -// ), -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () async { -// InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount); -// await widget.model.insertUserActivity(insertUserActivityRequestModel); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok.toUpperCase(), -// fontWeight: FontWeight.w400, -// )), -// ), -// ), -// ), -// ], -// ), -// ], -// ) -// ], -// ); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart deleted file mode 100644 index 4d02c27b..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// todo 'sikander' remove useless code -// ignore: must_be_immutable -// class SelectAmountDialog extends StatefulWidget { -// final Function(AmountModel) onValueSelected; -// AmountModel selectedAmount; -// -// SelectAmountDialog({Key key, this.onValueSelected, this.selectedAmount}); -// -// @override -// _SelectAmountDialogState createState() => _SelectAmountDialogState(); -// } -// -// class _SelectAmountDialogState extends State { -// List searchAmount = [ -// AmountModel(name: "l", nameAr: "لتر", value: 1), -// AmountModel(name: "ml", nameAr: "مم لتر", value: 2), -// ]; -// @override -// void initState() { -// super.initState(); -// widget.selectedAmount = widget.selectedAmount ?? searchAmount[0]; -// getLanguage(); -// } -// -// String languageID = "en"; -// -// void getLanguage() async { -// languageID = await sharedPref.getString(APP_LANGUAGE); -// setState(() {}); -// } -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// children: [ -// Column( -// children: [ -// Texts( -// TranslationBase.of(context).preferredunit, -// fontSize: 20, -// ), -// Divider(), -// ...List.generate( -// searchAmount.length, -// (index) => Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// SizedBox( -// height: 2, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// setState(() { -// widget.selectedAmount = searchAmount[index]; -// }); -// }, -// child: ListTile( -// title: Text(languageID == "ar" ? searchAmount[index].nameAr : searchAmount[index].name), -// leading: Radio( -// value: searchAmount[index], -// groupValue: widget.selectedAmount, -// activeColor: Colors.red[800], -// onChanged: (value) { -// setState(() { -// widget.selectedAmount = value; -// }); -// }, -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// ], -// ), -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).cancel.toUpperCase(), -// color: Colors.red, -// ), -// ), -// ), -// ), -// ), -// ), -// Container( -// width: 1, -// height: 30, -// color: Colors.grey[500], -// ), -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// widget.onValueSelected(widget.selectedAmount); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok, -// fontWeight: FontWeight.w400, -// )), -// ), -// ), -// ), -// ], -// ) -// ], -// ) -// ], -// ); -// } -// } -// -// class AmountModel { -// String name; -// String nameAr; -// int value; -// -// AmountModel({this.name, this.nameAr, this.value}); -// -// AmountModel.fromJson(Map json) { -// name = json['name']; -// nameAr = json['nameAr']; -// value = json['value']; -// } -// -// Map toJson() { -// final Map data = new Map(); -// data['name'] = this.name; -// data['nameAr'] = this.nameAr; -// data['value'] = this.value; -// return data; -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart deleted file mode 100644 index 641f6df7..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'Dialog/select_amount_dialog.dart'; - -// todo 'sikander' remove useless code -// class AddCustomAmount extends StatefulWidget { -// final H2OViewModel model; -// final Function changePageViewIndex; -// -// const AddCustomAmount({Key key, this.model, this.changePageViewIndex}) -// : super(key: key); -// -// @override -// _AddCustomAmountState createState() => _AddCustomAmountState(); -// } -// -// class _AddCustomAmountState extends State { -// TextEditingController _nameTextController = TextEditingController(); -// AmountModel selectedAmount; -// -// @override -// void initState() { -// setState(() { -// _nameTextController.text = "0"; -// }); -// super.initState(); -// } -// -// @override -// Widget build(BuildContext context) { -// return AppScaffold( -// isShowAppBar: true, -// appBarTitle:TranslationBase.of(context).customLabel, -// body: SingleChildScrollView( -// physics: ScrollPhysics(), -// child: Container( -// margin: EdgeInsets.all(12), -// child: Center( -// child: FractionallySizedBox( -// widthFactor: 0.94, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// SizedBox( -// height: 12, -// ), -// NewTextFields( -// hintText: TranslationBase.of(context).h2oAmountOfWater, -// // type: "Number", -// controller: _nameTextController, -// ), -// SizedBox( -// height: 12, -// ), -// InkWell( -// onTap: () => confirmAmountTypeDialog(), -// child: Container( -// padding: EdgeInsets.all(12), -// width: double.infinity, -// height: 65, -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(12), -// color: Colors.white), -// child: Row( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Texts(getAmountName()), -// Icon(Icons.arrow_drop_down) -// ], -// ), -// ), -// ), -// SizedBox( -// height: 12, -// ), -// SecondaryButton( -// textColor: Colors.white, -// label: TranslationBase.of(context).ok, -// onTap: () async { -// Navigator.of(context).pop(); -// showConfirmMessage (int.parse(_nameTextController.text), widget.model); -// }, -// // loading: model.state == ViewState.BusyLocal, -// disabled: _nameTextController.text.isEmpty || selectedAmount == null), -// SizedBox( -// height: 12, -// ), -// ], -// ), -// ), -// ), -// ), -// ), -// ); -// } -// -// -// void confirmAmountTypeDialog() { -// showDialog( -// context: context, -// child: SelectAmountDialog( -// selectedAmount: selectedAmount, -// onValueSelected: (value) { -// setState(() { -// selectedAmount = value; -// }); -// }, -// ), -// ); -// } -// -// -// String getAmountName() { -// if (selectedAmount != null) -// return selectedAmount.name; -// else -// return TranslationBase.of(context).selectUnit; -// } -// -// -// -// void showConfirmMessage(int amount, H2OViewModel model) { -// showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart index 904f4183..edc82034 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -126,7 +126,7 @@ class _H2oSettingState extends State { ), ), SizedBox(height: 12), - _containerWidget(inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController)), + inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController).withBorderedContainer, SizedBox(height: 16), Text( TranslationBase.of(context).preferredunit, @@ -210,80 +210,77 @@ class _H2oSettingState extends State { }, _weightPopupList), SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () { - showModalBottomSheet( - context: context, - builder: (context) { - return Container( - height: 250, - padding: EdgeInsets.all(8), - child: Column(children: [ - Container( - height: 40, - alignment: Alignment.centerRight, - child: Row(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - onTap: () => Navigator.pop(context), - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).cancel), - ), + CommonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () { + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + height: 250, + padding: EdgeInsets.all(8), + child: Column(children: [ + Container( + height: 40, + alignment: Alignment.centerRight, + child: Row(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + onTap: () => Navigator.pop(context), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).cancel), ), - SizedBox(width: 8), - InkWell( - onTap: () { - Navigator.pop(context); - setState(() { - _dobDate = _tempDate; - }); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).ok), - ), - ) - ]), - ), - Expanded( - child: Container( - width: MediaQuery.of(context).size.width, - child: CupertinoDatePicker( - initialDateTime: _dobDate, - mode: CupertinoDatePickerMode.date, - onDateTimeChanged: (_date) { - _tempDate = _date; - }, + ), + SizedBox(width: 8), + InkWell( + onTap: () { + Navigator.pop(context); + setState(() { + _dobDate = _tempDate; + }); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).ok), ), + ) + ]), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: CupertinoDatePicker( + initialDateTime: _dobDate, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (_date) { + _tempDate = _date; + }, ), - ) - ]), - ); - }); - }, iconData: Icons.calendar_today), - ), + ), + ) + ]), + ); + }); + }, iconData: Icons.calendar_today) + .withBorderedContainer, SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { - List list = [ - for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), - ]; + CommonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { + List list = [ + for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), + ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedActiveLevel, - onValueSelected: (index) { - _selectedActiveLevel = index; - setState(() {}); - }, - ), - ); - }), - ), + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedActiveLevel, + onValueSelected: (index) { + _selectedActiveLevel = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, SizedBox(height: 18), Text( TranslationBase.of(context).reminderLabel, @@ -296,25 +293,23 @@ class _H2oSettingState extends State { ), ), SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { - List list = [ - for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), - ]; + CommonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { + List list = [ + for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), + ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedRemindedTime, - onValueSelected: (index) { - _selectedRemindedTime = index; - setState(() {}); - }, - ), - ); - }), - ), + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedRemindedTime, + onValueSelected: (index) { + _selectedRemindedTime = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, ], ), ), @@ -333,58 +328,6 @@ class _H2oSettingState extends State { ); } - Widget _containerWidget(Widget child) { - return Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: child, - ); - } - - Widget _commonDropDownView(String title, String value, VoidCallback callback, {IconData iconData}) { - return InkWell( - onTap: callback, - child: Row( - children: [ - Expanded( - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - title, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.44, - ), - ), - Text( - value, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - ), - ]), - ), - Icon( - iconData ?? Icons.keyboard_arrow_down_sharp, - color: Color(0xff2E303A), - ) - ], - ), - ); - } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { return InkWell( onTap: hasSelection ? () {} : null, @@ -501,81 +444,79 @@ class _H2oSettingState extends State { Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, Function(bool) onUnitTap, _list) { - return _containerWidget( - Row( - children: [ - Expanded( - flex: 3, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _title, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.44, - ), + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, ), - TextField( - controller: _controller, - keyboardType: TextInputType.number, - onChanged: (value) { - double _value = double.parse(value); - if (_value > _maxValue) { - onTextValueChange(_maxValue.toStringAsFixed(0)); - onValueChange(_maxValue); - return; - } else if (_value < _minValue) { - onTextValueChange(_minValue.toStringAsFixed(0)); - onValueChange(_minValue); - return; - } else if (_value >= _minValue && _value <= _maxValue) { - onValueChange(_value); - return; - } - }, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), - ], - style: TextStyle( + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, color: Color(0xff575757), letterSpacing: -0.56, ), - decoration: InputDecoration( - isDense: true, - hintText: "0", - hintStyle: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), + ), + ], ), - Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), - Expanded( - flex: 1, - child: PopupMenuButton( - child: _commonDropDownView(TranslationBase.of(context).unit, unitTitle, null), - onSelected: (value) { - onUnitTap(value); - }, - itemBuilder: (context) => _list), - ) - ], - ), - ); + ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; } void _updateUserDetails() async { @@ -627,3 +568,65 @@ class _H2oSettingState extends State { }); } } + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], + ), + ); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index fe385ade..accd6887 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -18,9 +17,6 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:wave/config.dart'; import 'package:wave/wave.dart'; -import 'Dialog/confirm_add_amount_dialog.dart'; -import 'add_custom_amount.dart'; - class TodayPage extends StatefulWidget { TodayPage({Key key}) : super(key: key); diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart deleted file mode 100644 index 9b876cc1..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart +++ /dev/null @@ -1,201 +0,0 @@ -import 'dart:math' as math; - -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; - -import '../add_custom_amount.dart'; - - -// todo 'sikander' remove useless code - - -// class H20FloatingActionButton extends StatefulWidget { -// const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key); -// -// final H2OViewModel model; -// -// @override -// _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); -// } -// -// class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { -// AnimationController _controller; -// @override -// void initState() { -// _controller = new AnimationController( -// vsync: this, -// duration: const Duration(milliseconds: 500), -// ); -// super.initState(); -// } -// -// void showConfirmMessage(int amount, H2OViewModel model) { -// showDialog( -// context: context, -// child: ConfirmAddAmountDialog( -// model: model, -// amount: amount, -// ), -// ); -// } -// -// @override -// Widget build(BuildContext context) { -// return Container( -// margin: EdgeInsets.only(left: 20, right: 20), -// child: new Column(mainAxisSize: MainAxisSize.min, children: [ -// Row( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// Column( -// crossAxisAlignment: CrossAxisAlignment.end, -// children: [ -// ActionButton( -// controller: _controller, -// text: "600${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(600, widget.model); -// }, -// ), -// ActionButton( -// controller: _controller, -// text: "330${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(330, widget.model); -// }, -// ), -// ActionButton( -// controller: _controller, -// text: "200${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(200, widget.model); -// }, -// ), -// ], -// ), -// ], -// ), -// Row( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// FloatingActionButton( -// heroTag: null, -// child: new AnimatedBuilder( -// animation: _controller, -// builder: (BuildContext context, Widget child) { -// return new Transform( -// transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi), -// alignment: FractionalOffset.center, -// child: new Icon(_controller.isDismissed ? Icons.add : Icons.close), -// ); -// }, -// ), -// onPressed: () { -// if (_controller.isDismissed) { -// _controller.forward(); -// } else { -// _controller.reverse(); -// } -// }, -// ), -// new Container( -// margin: EdgeInsets.only(left: 8, bottom: 4), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// backgroundColor: Colors.white, -// heroTag: null, -// // mini: true, -// child: Text( -// TranslationBase.of(context).custom, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12, color: Colors.grey), -// ), -// onPressed: () { -// Navigator.push( -// context, -// FadePage( -// page: AddCustomAmount( -// model: widget.model, -// ), -// ), -// ); -// }, -// ), -// ), -// ), -// new Container( -// margin: EdgeInsets.only(left: 8, bottom: 4), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// backgroundColor: Colors.white, -// heroTag: null, -// //mini: true, -// child: Text( -// TranslationBase.of(context).undo, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12.0, color: Colors.grey), -// ), -// onPressed: undoVolume, -// ), -// ), -// ), -// ], -// ), -// ]), -// ); -// } -// -// void undoVolume() async { -// GifLoaderDialogUtils.showMyDialog(context); -// await widget.model.undoUserActivity(); -// GifLoaderDialogUtils.hideDialog(context); -// } -// } -// -// class ActionButton extends StatelessWidget { -// const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap}) -// : _controller = controller, -// super(key: key); -// -// final AnimationController _controller; -// final String text; -// final Function onTap; -// -// @override -// Widget build(BuildContext context) { -// return Container( -// margin: EdgeInsets.only(left: 4, bottom: 8), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// heroTag: null, -// backgroundColor: Colors.white, -// //mini: true, -// child: Text( -// text, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12.0, color: Colors.grey), -// ), -// onPressed: onTap), -// ), -// ); -// } -// } diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index e3888240..ffb7e1ee 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; + //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; @@ -10,14 +11,14 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.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/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -26,8 +27,6 @@ import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:provider/provider.dart'; import 'dialogs/SelectBeneficiaryDialog.dart'; -import 'dialogs/SelectBloodDialog.dart'; -import 'dialogs/SelectGenderDialog.dart'; import 'dialogs/SelectPatientFamilyDialog.dart'; import 'dialogs/SelectPatientInfoDialog.dart'; @@ -44,11 +43,16 @@ class _BloodDonationPageState extends State { TextEditingController _fileTextController = TextEditingController(); TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; - Gender gender = Gender.Male; //Gender.NON; - Blood blood = Blood.Aminus; //Blood.NON; + + // Gender gender = Gender.Male; //Gender.NON; + // Blood blood = Blood.Aminus; //Blood.NON; //HospitalsModel _selectedHospital; CitiesModel _selectedHospital; + int _selectedHospitalIndex = 0; + int _selectedGenderIndex = 1; + int _selectedBloodTypeIndex = 0; + String amount = ""; String email; PatientInfo _selectedPatientInfo; @@ -81,182 +85,193 @@ class _BloodDonationPageState extends State { return BaseView( onModelReady: (model) => model.getCities(), //model.getHospitals(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - baseViewModel: model, - imagesInfo: imagesInfo, - description: TranslationBase.of(context).bloodDonationInfo, - appBarTitle: TranslationBase.of(context).bloodD, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).bloodDEnterDesc - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectHospitalDialog(model.CitiesModelList), - //model.hospitals - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(getHospitalName(projectProvider, context), color: Colors.black), Icon(Icons.arrow_drop_down)], - ), - ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectGenderDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getGender(context), color: Colors.black), - Icon(Icons.arrow_drop_down) - ], - ), + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF7F7F7), + showNewAppBarTitle: true, + baseViewModel: model, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).bloodDonationInfo, + appBarTitle: TranslationBase.of(context).bloodD, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).bloodDEnterDesc, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectBloodDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(getBlood(), color: Colors.black), Icon(Icons.arrow_drop_down)], - ), - ), - ), - SizedBox( - height: 12, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Text( + SizedBox(height: 12), + CommonDropDownView( + TranslationBase.of(context).city, + model.CitiesModelList.isNotEmpty + ? projectProvider.isArabic + ? model.CitiesModelList[_selectedHospitalIndex].descriptionN + : model.CitiesModelList[_selectedHospitalIndex].description + : "", () { + List list = [ + for (int i = 0; i < model.CitiesModelList.length; i++) + RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = model.CitiesModelList[index]; + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).male, 1), + RadioSelectionDialogModel(TranslationBase.of(context).female, 2), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedGenderIndex, + onValueSelected: (index) { + _selectedGenderIndex = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).bloodType, getBlood(_selectedBloodTypeIndex), () { + List list = [ + RadioSelectionDialogModel("O+", 0), + RadioSelectionDialogModel("O-", 1), + RadioSelectionDialogModel("AB+", 2), + RadioSelectionDialogModel("AB-", 3), + RadioSelectionDialogModel("A+", 4), + RadioSelectionDialogModel("A-", 5), + RadioSelectionDialogModel("B+", 6), + RadioSelectionDialogModel("B-", 7), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedBloodTypeIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedBloodTypeIndex = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( TranslationBase.of(context).viewTermsConditions + ":", - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.w600, color: Color(0xff2E303A), fontSize: 14, letterSpacing: -0.56), ), - ), - InkWell( - onTap: () { - Navigator.of(context).push(FadePage(page: UserAgreementPage())); - }, - child: Container( - child: Texts( + InkWell( + onTap: () { + Navigator.of(context).push(FadePage(page: UserAgreementPage())); + }, + child: Text( TranslationBase.of(context).clickHere, - color: Colors.blue, - fontSize: 14.0, + style: TextStyle(fontWeight: FontWeight.w600, color: Colors.blue, fontSize: 14, letterSpacing: -0.56), ), + ) + ], + ), + SizedBox(height: 12), + Row( + children: [ + Checkbox( + onChanged: (bool value) { + setState(() { + checkedValue = value; + }); + }, + value: checkedValue, + activeColor: Color(0xFFc5272d), + ), + Text( + TranslationBase.of(context).iAgreeToTheTermsAndConditions, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), ), - ) - ], - ), - SizedBox( - height: 12, - ), - Row( - children: [ - Checkbox( - onChanged: (bool value) { - setState(() { - checkedValue = value; - }); - }, - value: checkedValue, - activeColor: Color(0xFFc5272d), - ), - Text( - TranslationBase.of(context).iAgreeToTheTermsAndConditions, - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), - ), - ], - ), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Container( - color: Theme.of(context).primaryColor, - width: 350, - child: InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - title: Text( - "", - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: Image.asset('assets/images/BloodChrt_EN.png'), - buttonCancelText: Text(TranslationBase.of(context).cancel), - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - )); - }, - child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + color: Theme.of(context).primaryColor, + width: 350, + child: InkWell( + onTap: () { + showDialog( + context: context, + builder: (_) => AssetGiffyDialog( + title: Text( + "", + style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), + ), + image: Image.asset('assets/images/BloodChrt_EN.png'), + buttonCancelText: Text(TranslationBase.of(context).cancel), + buttonCancelColor: Colors.grey, + onlyCancelButton: true, + )); + }, + child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), + ), ), ), - ), - ], - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + ], + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), ), ), - ), - bottomSheet: Container( - width: double.infinity, - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(20), - child: DefaultButton(TranslationBase.of(context).save, () async { + DefaultButton(TranslationBase.of(context).save, () async { if (_selectedHospital == null) { AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); return; } bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; bloodDetails.cityCode = _selectedHospital.iD.toString(); - bloodDetails.gender = gender == Gender.Male ? 1 : 2; + bloodDetails.gender = _selectedGenderIndex; + bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); await model.updateBloodGroup(bloodDetails); if (model.state == ViewState.Idle) { AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); } else { AppToast.showErrorToast(message: model.error); } - }), - )), + }).insideContainer + ], + ), + ), ); } @@ -280,106 +295,6 @@ class _BloodDonationPageState extends State { ); } - void confirmSelectBloodDialog() { - showDialog( - context: context, - child: SelectBloodDialog( - bloodType: blood, - onValueSelected: (value) { - setState(() { - if (value == Blood.Oplus) { - bloodDetails.bloodGroup = "O+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Ominus) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.bloodGroup = "O-"; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABplus) { - bloodDetails.bloodGroup = "AB+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABminus) { - bloodDetails.bloodGroup = "AB-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aplus) { - bloodDetails.bloodGroup = "A+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aminus) { - bloodDetails.bloodGroup = "A-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bplus) { - bloodDetails.bloodGroup = "B+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bminus) { - bloodDetails.bloodGroup = "B-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - // beneficiaryType = value; - blood = value; - }); - }, - ), - ); - } - - void confirmSelectGenderDialog() { - showDialog( - context: context, - child: SelectGenderDialog( - beneficiaryType: gender, - onValueSelected: (value) { - setState(() { - if (value == Gender.Male) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.patientType = 1; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - // _fileTextController.text = ""; - { - bloodDetails.gender = 2; - } - - // beneficiaryType = value; - gender = value; - }); - }, - ), - ); - } - -//void confirmSelectHospitalDialog(List hospitals) { - void confirmSelectHospitalDialog(List hospitals) { - showDialog( - context: context, - child: SelectCiteisDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); - }, - ), - ); - } - void confirmSelectPatientDialog(List patientInfoList) { showDialog( context: context, @@ -429,54 +344,39 @@ class _BloodDonationPageState extends State { return TranslationBase.of(context).selectBeneficiary; } - String getGender(BuildContext context) { - switch (gender) { - case Gender.Male: - return TranslationBase.of(context).male; - case Gender.Female: - return TranslationBase.of(context).female; - break; - - case Gender.NON: - return TranslationBase.of(context).selectGender; - } - return TranslationBase.of(context).selectGender; - } - - String getBlood() { - switch (blood) { - case Blood.Oplus: + String getBlood(int index) { + switch (index) { + case 0: return "O+"; break; - case Blood.Ominus: + case 1: return "O-"; break; - case Blood.ABplus: + case 2: return "AB+"; break; - case Blood.ABminus: + case 3: return "AB-"; break; - case Blood.Aplus: + case 4: return "A+"; break; - case Blood.Aminus: + case 5: return "A-"; break; - case Blood.Bplus: + case 6: return "B-"; break; - case Blood.Bminus: + case 7: return "B-"; break; - case Blood.Bplus: + case 8: return "B+"; break; - case Blood.NON: - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; + default: + return ""; } - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; } String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { diff --git a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart b/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart deleted file mode 100644 index b31d4a38..00000000 --- a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// todo 'sikander' remove useless code -// class ConfirmExitPageDialog extends StatelessWidget { -// final GestureTapCallback onTapYes; -// final GestureTapCallback onTapNo; -// -// const ConfirmExitPageDialog({Key key, this.onTapYes, this.onTapNo}) -// : super(key: key); -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), -// title: Center( -// child: Texts( -// TranslationBase.of(context).confirm, -// color: Colors.black, -// ), -// ), -// children: [ -// Column( -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// Texts( -// "Are you sure you want to exit this page ?", -// color: Colors.grey, -// ), -// SizedBox( -// height: 5, -// ), -// Divider(), -// SizedBox( -// height: 5.0, -// ), -// Row( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// InkWell( -// onTap: () { -// onTapNo(); -// }, -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).no, -// color: Colors.red, -// ), -// ), -// ), -// ), -// -// InkWell( -// onTap: () { -// Navigator.pop(context); -// onTapYes(); -// }, -// child: Container( -// child: Center( -// child: Texts(TranslationBase.of(context).yes), -// ), -// ), -// ), -// ], -// ), -// SizedBox( -// height: 20.0, -// ), -// ], -// ) -// ], -// ); -// } -// } diff --git a/lib/pages/ErService/EdOnline/DdServicesPage.dart b/lib/pages/ErService/EdOnline/DdServicesPage.dart index 457e199c..dc2e8d78 100644 --- a/lib/pages/ErService/EdOnline/DdServicesPage.dart +++ b/lib/pages/ErService/EdOnline/DdServicesPage.dart @@ -5,8 +5,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - -import 'ConfirmExitPageDialog.dart'; import 'EdOnlineAgreementPage.dart'; import 'EdOnlineNotesPage.dart'; import 'EdOnlineQuestionsPage.dart'; @@ -104,21 +102,4 @@ class _DdServicesPageState extends State { ), ); } - - // todo 'sikander' remove useless code - // void showConfirmMessage( - // BuildContext context, - // ) { - // showDialog( - // context: context, - // child: ConfirmExitPageDialog( - // onTapYes: () { - // Navigator.pop(context); - // }, - // onTapNo: () { - // Navigator.pop(context); - // }, - // ), - // ); - // } } diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index dc1b47f7..298e617e 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -498,42 +498,6 @@ class _SendFeedbackPageState extends State { ); 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); - // }, - // )); } openSpeechReco() async { @@ -586,239 +550,4 @@ class _SendFeedbackPageState extends State { print(hasSpeech); if (!mounted) return; } -} -// 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 { -// MessageType messageTypeDialog = MessageType.NON; -// -// setMessageDialogType(MessageType messageType) { -// setState(() { -// messageTypeDialog = messageType; -// }); -// } -// -// @override -// void initState() { -// messageTypeDialog = widget.messageTypeDialog; -// -// super.initState(); -// } -// -// Widget build(BuildContext context) { -// return BaseView( -// builder: (_, model, widge) => SimpleDialog( -// title: Text( -// TranslationBase.of(context).messageType, -// textAlign: TextAlign.center, -// ), -// children: [ -// Container( -// // padding: const EdgeInsets.all(10.0), -// child: Column( -// children: [ -// Divider( -// height: 2.5, -// color: Colors.grey[500], -// ), -// Row( -// children: [ -// 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: [ -// 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: [ -// 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: [ -// 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: [ -// 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: [ -// 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: [ -// 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, -// )), -// ), -// )), -// ], -// ) -// ], -// ), -// ), -// ], -// ), -// ); -// } -// } +} \ No newline at end of file diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 9498282b..7f4d8621 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -388,13 +388,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { ); } - // todo 'sikander' remove useless code - // showDialogs(String message) { - // ConfirmDialog dialog = new ConfirmDialog( - // context: context, confirmMessage: message, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => {}, cancelFunction: () => {}); - // dialog.showAlertDialog(context); - // } - Future> requestPermissions() async { var permissionResults = [ Permission.location, diff --git a/lib/pages/medical/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index 389baf24..877c52fc 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -111,15 +111,6 @@ class AskDoctorPage extends StatelessWidget { ); } - // todo 'sikander' remove this later - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; - } - String getDate(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); return DateUtil.getWeekDay(dateObj.weekday) + diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index 7c96dc3e..9eb3e1a5 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -216,30 +216,6 @@ class _AddWeightPageState extends State { ), ); return; - - // todo 'sikander' remove useless code - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).removeMeasure, - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); - - 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); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); }) ], ), diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index 22430242..274ef651 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -1,5 +1,9 @@ import 'package:flutter/material.dart'; +extension WithContainer on DefaultButton { + Widget get insideContainer => Container(color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); +} + class DefaultButton extends StatelessWidget { final String text; final VoidCallback onPress; diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index 198e25de..4cbfdcc4 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -13,8 +13,9 @@ class RadioSelectionDialog extends StatefulWidget { final Function(int) onValueSelected; final List listData; final int selectedIndex; + final bool isScrollable; - const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex}) : super(key: key); + const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false}) : super(key: key); @override State createState() => new RadioSelectionDialogState(); @@ -68,36 +69,41 @@ class RadioSelectionDialogState extends State { TranslationBase.of(context).pleaseSelectFromBelowOptions, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), - ListView.separated( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.only(bottom: 42, top: 10), - itemBuilder: (context, index) { - return Row( - children: [ - SizedBox( - width: 22, - height: 22, - child: Radio( - value: widget.listData[index].value, - groupValue: selectedIndex, - onChanged: (value) { - setState(() { - selectedIndex = value; - }); - }, + SizedBox(height: widget.isScrollable ? 12 : 0), + SizedBox( + height: widget.isScrollable ? MediaQuery.of(context).size.height * .4 : null, + child: ListView.separated( + physics: widget.isScrollable ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(), + shrinkWrap: !widget.isScrollable, + padding: EdgeInsets.only(bottom: widget.isScrollable ? 21 : 42, top: 10), + itemBuilder: (context, index) { + return Row( + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: widget.listData[index].value, + groupValue: selectedIndex, + onChanged: (value) { + setState(() { + selectedIndex = value; + }); + }, + ), ), - ), - SizedBox(width: 8), - Text( - widget.listData[index].title, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), - ), - ], - ); - }, - separatorBuilder: (context, index) => SizedBox(height: 10), - itemCount: widget.listData.length), + SizedBox(width: 8), + Text( + widget.listData[index].title, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), + ), + ], + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 10), + itemCount: widget.listData.length), + ), + SizedBox(height: widget.isScrollable ? 12 : 0), Row( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 600522f3..6fccaec4 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -225,34 +225,6 @@ class SMSOTP { }); } - - // 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: [ - // Center( - // child: CircularProgressIndicator( - // valueColor: AlwaysStoppedAnimation(Colors.black), - // ), - // ) - // ], - // ); - // }); - // } - static void hideSMSBox(context) { Navigator.pop(context); }