diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 2f86e5a1..38009f45 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -45,7 +45,7 @@ class PrescriptionsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); - await getPrescriptionsOrders(); +// await getPrescriptionsOrders(); setState(ViewState.Idle); } } diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index 85182717..85c3544c 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -1,13 +1,17 @@ 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'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -17,13 +21,27 @@ import 'package:wave/wave.dart'; import 'Dialog/confirm_add_amount_dialog.dart'; import 'add_custom_amount.dart'; -class TodayPage extends StatelessWidget { +class TodayPage extends StatefulWidget { + TodayPage({Key key}) : super(key: key); + @override + _TodayPageState createState() { + return _TodayPageState(); + } +} + +class _TodayPageState extends State { + TextEditingController _h20AmountController = TextEditingController(); + + bool isUnitML = true; Future readPrefs() async { SharedPreferences prefs = await SharedPreferences.getInstance(); - return (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false; + isUnitML = (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false; + return isUnitML; } + bool canShowAddButton = false; + @override Widget build(BuildContext context) { return BaseView( @@ -46,7 +64,6 @@ class TodayPage extends StatelessWidget { child: FutureBuilder( future: readPrefs(), builder: (context, data) { - var isUnitML = true; String unit; if (data.connectionState == ConnectionState.done) { isUnitML = data.data; @@ -152,8 +169,6 @@ class TodayPage extends StatelessWidget { _circularButton(context, 330, model), SizedBox(height: 8), _circularButton(context, 200, model), - // SizedBox(height: 8), - // _circularButton(context, 0, model, isCustom: true), SizedBox(height: 8), InkWell( onTap: () => undoVolume(context, model), @@ -175,24 +190,114 @@ class TodayPage extends StatelessWidget { ), ), SizedBox(height: 40), - // Text( - // TranslationBase.of(context).addCustomAmount, - // style: TextStyle( - // fontSize: 14, - // height: 21 / 14, - // fontWeight: FontWeight.w600, - // color: Color(0xff2B353E), - // letterSpacing: -0.56, - // ), - // ), + Text( + TranslationBase.of(context).addCustomAmount, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.56, + ), + ), + SizedBox(height: 12), + 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: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).amount, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + TextField( + controller: _h20AmountController, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = 0; + if (value.length > 0) _value = double.parse(value); + if (value.length > 0) { + if (canShowAddButton) { + return; + } + canShowAddButton = true; + setState(() {}); + } else { + canShowAddButton = false; + setState(() {}); + } + }, + 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, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (canShowAddButton) + Expanded( + flex: 1, + child: DefaultButton( + TranslationBase.of(context).add, + () async { + await showConfirmMessage(context, int.parse(_h20AmountController.text), model); + _h20AmountController.text = ""; + canShowAddButton = false; + SystemChannels.textInput.invokeMethod('TextInput.hide'); + setState(() {}); + }, + ), + ), + ], + ), + ], + ), + ), ], ), ), - // floatingActionButton: H20FloatingActionButton( - // // controller: _controller, - // model: model, - // ), ), ); } @@ -252,12 +357,19 @@ class TodayPage extends StatelessWidget { ); } - void showConfirmMessage(context, int amount, H2OViewModel model) { - showDialog( + Future showConfirmMessage(context, int amount, H2OViewModel model) async { + String title = "${TranslationBase.of(context).areyousure} $amount ${(isUnitML ? TranslationBase.of(context).ml : TranslationBase.of(context).l).toLowerCase()} ?"; + await showDialog( context: context, - child: ConfirmAddAmountDialog( - model: model, - amount: amount, + child: ConfirmWithMessageDialog( + message: title, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: amount); + await model.insertUserActivity(insertUserActivityRequestModel); + GifLoaderDialogUtils.hideDialog(context); + FocusManager.instance.primaryFocus.unfocus(); + }, ), ); } diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index cd34a98e..2287cff5 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -56,135 +56,169 @@ class _SchedulePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getDoctorSchedule(doctorList), - allowAny: true, - builder: (_, model, widget) => BaseView( - onModelReady: (model2) => model2.getFreeSlots(doctorList), - allowAny: true, - builder: (_, model2, widget2) { - if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { - this.freeSlots = model2.freeSlots; - this.doctorScheduleResponse = model.getDoctorScheduleList; - - this.generateWeeksSchedules(); - } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { - AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); - Navigator.pop(context); - } - return AppScaffold( - appBarTitle: TranslationBase.of(context).schedule, - showNewAppBar: true, - showNewAppBarTitle: true, - isShowAppBar: true, - baseViewModel: model2, - isShowDecPage: false, - body: SizedBox( - height: MediaQuery.of(context).size.height, - child: Stack( - children: [ - Container( - margin: EdgeInsets.only(top: 40), - child: PageView.builder( - controller: _pageController, - itemCount: weeks.length, - onPageChanged: (index) { - setState(() { - isPageChange = true; - this.currentPage = index.toDouble(); - }); - }, - itemBuilder: (context, index) { - return Container( - child: ListView.builder( - itemCount: weeks[index].length, - itemBuilder: (context, index2) => InkWell( - onTap: () { - openBookAppointment(weeks[index][index2]); - }, - child: Row( - children: [ - Expanded( - flex: 1, - child: Padding( - padding: projectViewModel.isArabic ? EdgeInsets.only(right: 20) : EdgeInsets.only(left: 20), - child: Row(children: [ - Column( - children: [ - Texts( - weeks[index][index2]['DayName'], - fontSize: 13, - fontWeight: projectViewModel.isArabic ? FontWeight.w600 : FontWeight.w500, - ), - Texts( - getDayMonths( - DateUtil.convertStringToDate( - weeks[index][index2]['Date'], - ), - ), - fontWeight: FontWeight.bold, - fontSize: 18, - ) - ], - ) - ])), - ), - Expanded( - flex: 3, - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(20.0)), - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 20), - margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7), - decoration: BoxDecoration(boxShadow: [ - DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10) - ? BoxShadow(color: Colors.green, offset: Offset(projectViewModel.isArabic ? 5 : -5, 0)) - : BoxShadow( - color: Colors.grey[100], - blurRadius: 5, - spreadRadius: 4, - offset: Offset(0, 10), - ), - ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10) - ? Texts( - TranslationBase.of(context).today, - color: Colors.green, - fontWeight: FontWeight.w600, - fontSize: 12, - marginTop: 0, - ) - : SizedBox(), - Row( - children: [ - Expanded( - child: Texts( - weeks[index][index2]['WorkingHours'], - fontWeight: FontWeight.w500, - ), - ), - Icon(projectViewModel.isArabic - ? Icons - .arrow_back_ios_outlined - : Icons - .arrow_forward_outlined, size: 16.0), - ], - ) - ]))), - ), - ], - ) - ))); + onModelReady: (model) => model.getDoctorSchedule(doctorList), + allowAny: true, + builder: (_, model, widget) => BaseView( + onModelReady: (model2) => model2.getFreeSlots(doctorList), + allowAny: true, + builder: (_, model2, widget2) { + if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { + this.freeSlots = model2.freeSlots; + this.doctorScheduleResponse = model.getDoctorScheduleList; + + this.generateWeeksSchedules(); + } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { + AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); + Navigator.pop(context); + } + return AppScaffold( + appBarTitle: TranslationBase.of(context).schedule, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowAppBar: true, + backgroundColor: Color(0xffF7F7F7), + baseViewModel: model2, + isShowDecPage: false, + body: Column( + children: [ + SizedBox(height: 21), + PageViewIndicator( + isActive: true, + currentPage: this.currentPage, + length: weeks.length, + ), + Expanded( + child: PageView.builder( + controller: _pageController, + itemCount: weeks.length, + onPageChanged: (index) { + setState(() { + isPageChange = true; + this.currentPage = index.toDouble(); + }); + }, + itemBuilder: (context, index) { + return ListView.separated( + itemCount: weeks[index].length, + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) => SizedBox(height: 12), + itemBuilder: (context, index2) { + bool isToday = DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10); + Color toDayColor = isToday ? Color(0xff359846) : Colors.white; + + return InkWell( + onTap: () { + openBookAppointment(weeks[index][index2]); }, - )), - PageViewIndicator( - isActive: true, - currentPage: this.currentPage, - length: weeks.length, - ) - ], - ))); - })); + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + weeks[index][index2]['DayName'], + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.52, + ), + ), + Text( + getDayMonths(DateUtil.convertStringToDate(weeks[index][index2]['Date'])), + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w700, + color: Color(0xff2E303A), + letterSpacing: -0.72, + ), + ), + ], + ), + ), + Expanded( + flex: 3, + child: Container( + decoration: BoxDecoration( + color: toDayColor, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + 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: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + if (isToday) + Text( + TranslationBase.of(context).today, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: toDayColor, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Expanded( + child: Text( + weeks[index][index2]['WorkingHours'], + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + ), + ], + ) + ]), + ), + Icon(Icons.arrow_forward, color: Color(0xff2B353E)), + ], + ), + ), + ), + ), + ], + ), + ); + }); + }, + ), + ), + ], + ), + ); + }), + ); } generateWeeksSchedules() { diff --git a/lib/pages/MyAppointments/widgets/indicator.dart b/lib/pages/MyAppointments/widgets/indicator.dart index 5976042f..e652e360 100644 --- a/lib/pages/MyAppointments/widgets/indicator.dart +++ b/lib/pages/MyAppointments/widgets/indicator.dart @@ -37,11 +37,11 @@ class PageViewIndicator extends StatelessWidget { Widget circleBar(bool isActive) { return AnimatedContainer( duration: Duration(milliseconds: 150), - margin: EdgeInsets.symmetric(horizontal: 3), - height: isActive ? 12 : 8, - width: isActive ? 12 : 8, + margin: EdgeInsets.symmetric(horizontal: 4), + height: isActive ? 12 : 12, + width: isActive ? 12 : 12, decoration: BoxDecoration( - color: isActive ? Colors.red : Colors.grey, + color: isActive ? Color(0xffD02127) : Color(0xffD0D0D0), borderRadius: BorderRadius.all(Radius.circular(12))), ); } diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index cfb24c2a..1da0adb6 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_h import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -21,128 +21,130 @@ class PrescriptionsHistoryPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( - baseViewModel: prescriptionsViewModel, - body: ListView.separated( - physics: BouncingScrollPhysics(), - padding: EdgeInsets.all(21), - separatorBuilder: (context, index) { - return SizedBox(height: 12); - }, - itemBuilder: (context, index) { - int status = prescriptionsViewModel.prescriptionsHistory[index].status; - String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; - Color _color; - if (status == 1) { - //pending - _color = Color(0xffCC9B14); - } else if (status == 2) { - //processing - _color = Color(0xff2E303A); - } else if (status == 3) { - //completed - _color = Color(0xff359846); - } else if (status == 4) { - //cancel // Rejected - _color = Color(0xffD02127); - } + return BaseView( + onModelReady: (model) => model.getPrescriptionsOrders(showLoading: true), + builder: (_, model, widget) => AppScaffold( + baseViewModel: prescriptionsViewModel, + body: ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) { + return SizedBox(height: 12); + }, + itemBuilder: (context, index) { + int status = prescriptionsViewModel.prescriptionsHistory[index].status; + String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4) { + //cancel // Rejected + _color = Color(0xffD02127); + } - return InkWell( - onTap: () async { - final result = await Navigator.push( - context, - FadePage( - page: PrescriptionsHistoryDetailsPage( - prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], - ), - ), - ); - if (result != null) { - showOrderLog(); - } - }, - child: Container( - height: 65, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - width: 6, - decoration: BoxDecoration( - color: _color, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + return InkWell( + onTap: () async { + final result = await Navigator.push( + context, + FadePage( + page: PrescriptionsHistoryDetailsPage( + prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], + ), + ), + ); + if (result != null) { + showOrderLog(); + } + }, + child: Container( + height: 65, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - ), - ), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), child: Row( - crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _statusDisp, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), - ), - Text( - '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - ], + Container( + width: 6, + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + ), ), ), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), - ), - Text( - DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + Expanded( + child: Padding( + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) + ], ), - ], - ) + ), + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + mWidth(6), ], ), - ), - ), - Icon( - Icons.arrow_forward, - size: 16, - ), - mWidth(6), - ], - ), - )); - }, - itemCount: prescriptionsViewModel.prescriptionsHistory.length, - ), - ); + )); + }, + itemCount: prescriptionsViewModel.prescriptionsHistory.length, + ), + )); } } diff --git a/lib/widgets/dialogs/ConfirmWithMessageDialog.dart b/lib/widgets/dialogs/ConfirmWithMessageDialog.dart index 04e2027d..fca0dd19 100644 --- a/lib/widgets/dialogs/ConfirmWithMessageDialog.dart +++ b/lib/widgets/dialogs/ConfirmWithMessageDialog.dart @@ -1,101 +1,85 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ConfirmWithMessageDialog extends StatelessWidget { + final String title; final String message; final String okTitle; - final GestureTapCallback onTap; + final VoidCallback onTap; - const ConfirmWithMessageDialog({Key key, this.message, this.okTitle, this.onTap}) : super(key: key); + const ConfirmWithMessageDialog({Key key, this.title, @required this.message, this.okTitle, this.onTap}) : super(key: key); @override Widget build(BuildContext context) { - return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 12.0), - children: [ - Column( + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder(), + insetPadding: EdgeInsets.only(left: 21, right: 21), + child: Padding( + padding: EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), + child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Text( - TranslationBase.of(context).confirm, - style: TextStyle( - color: Colors.black, - fontSize: 22, - letterSpacing: -0.94, - fontWeight: FontWeight.bold, - ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(top: 16.0), + child: Text( + title ?? TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), + ), + ), + ), + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.close), + color: Color(0xff2B353E), + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], ), Text( message, - style: TextStyle( - fontSize: 14, - color: CustomColors.grey, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48), ), - mHeight(20), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Container( - decoration: containerRadius(CustomColors.darkGreyColor, 6), - padding: EdgeInsets.all(6), - child: Center( - child: Text( - TranslationBase.of(context).cancel, - style: TextStyle( - color: Colors.black, - fontSize: 16, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - ), + SizedBox(height: 28), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancel_nocaps, + () => Navigator.pop(context), + textColor: Color(0xff2B353E), + color: Color(0xffEAEAEA), ), - mWidth(12), - Expanded( - child: InkWell( - onTap: () { - Navigator.pop(context); - onTap(); - }, - child: Container( - decoration: containerRadius(CustomColors.accentColor, 6), - padding: EdgeInsets.all(6), - child: Center( - child: Text( - okTitle, - style: TextStyle( - color: Colors.white, - fontSize: 16, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + okTitle ?? TranslationBase.of(context).ok, + () { + Navigator.pop(context); + onTap(); + }, ), - ], - ), + ), + ], ), - ], - ) - ], + ), + ), ); } }