From eceb3976ad731b612af62702a641c25261ac756c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 16 Nov 2021 10:00:20 +0200 Subject: [PATCH] fix issues happend after merge --- lib/config/size_config.dart | 16 - .../Prescriptions/prescription_report.dart | 2 +- .../viewModel/authentication_view_model.dart | 18 +- lib/screens/home/home_screen.dart | 2 + .../reschedule-leaves/reschedule_leave.dart | 1181 ++++++++--------- pubspec.lock | 139 +- 6 files changed, 729 insertions(+), 629 deletions(-) diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index dc58e3e6..3e07990b 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -92,22 +92,6 @@ class SizeConfig { return widthMultiplier; } - static getTextMultiplierBasedOnWidth({double? width}) { - // TODO handel LandScape case - if (width != null) { - return width / 100; - } - return widthMultiplier; - } - - static getWidthMultiplier({double? width}) { - // TODO handel LandScape case - if (width != null) { - return width / 100; - } - return widthMultiplier; - } - static getHeightMultiplier({double? height}) { // TODO handel LandScape case if (height != null) { diff --git a/lib/core/model/Prescriptions/prescription_report.dart b/lib/core/model/Prescriptions/prescription_report.dart index 56e835ef..4b5d574a 100644 --- a/lib/core/model/Prescriptions/prescription_report.dart +++ b/lib/core/model/Prescriptions/prescription_report.dart @@ -5,7 +5,7 @@ class PrescriptionReport { String? companyName; dynamic? days; String? doctorName; - var? doseDailyQuantity; + var doseDailyQuantity; String? frequency; dynamic? frequencyNumber; String? image; diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 7e081697..a5bedff8 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -318,28 +318,27 @@ class AuthenticationViewModel extends BaseViewModel { } } + /// call firebase service to check if the user already login in before or not /// call firebase service to check if the user already login in before or not getDeviceInfoFromFirebase() async { _firebaseMessaging.setAutoInitEnabled(true); if (Platform.isIOS) { - await _firebaseMessaging.requestPermission(sound: true, badge: true, alert: true, provisional: true); - } - setState(ViewState.Busy); - } catch (e) { - Helpers.showErrorToast("fdfdfdfdf" + e.toString()); + _firebaseMessaging.requestNotificationPermissions(); } + setState(ViewState.Busy); var token = await _firebaseMessaging.getToken(); if (localToken == "") { - localToken = token!; + localToken = token; await _authService.selectDeviceImei(localToken); if (_authService.hasError) { - error = _authService.error!; + error = _authService.error; setState(ViewState.ErrorLocal); } else { if (_authService.dashboardItemsList.length > 0) { - user = _authService.dashboardItemsList[0]; - sharedPref.setObj(LAST_LOGIN_USER, _authService.dashboardItemsList[0]); + user =_authService.dashboardItemsList[0]; + sharedPref.setObj( + LAST_LOGIN_USER, _authService.dashboardItemsList[0]); await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, user.vidaRefreshTokenID); await sharedPref.setString(VIDA_AUTH_TOKEN_ID, @@ -353,6 +352,7 @@ class AuthenticationViewModel extends BaseViewModel { } } + /// determine the status of the app APP_STATUS get status { if (state == ViewState.Busy) { diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 585596e5..c609ad7a 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; @@ -18,6 +19,7 @@ import 'package:doctor_app_flutter/screens/patients/patient_search/patient_searc import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; import 'package:doctor_app_flutter/screens/patients/register_patient/RegisterPatientPage.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 6db77387..7d90c9a8 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -37,19 +37,19 @@ class _RescheduleLeaveScreen extends State { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); TextEditingController _toDateController = new TextEditingController(); TextEditingController _toDateController2 = new TextEditingController(); - late ProjectViewModel projectsProvider; - late SickLeaveViewModel sickLeaveViewModel; - + ProjectViewModel projectsProvider; + SickLeaveViewModel sickLeaveViewModel; + String _selectedClinic; Map profile = {}; - String offTime = '1'; + var offTime = '1'; var date; var doctorID; var reason; dynamic fromDate; dynamic toDate; var clinicID; - late String fromTime; - late String toTime; + String fromTime; + String toTime; TextEditingController _controller4 = new TextEditingController(); TextEditingController _controller5 = new TextEditingController(); void _presentDatePicker(id) { @@ -104,620 +104,615 @@ class _RescheduleLeaveScreen extends State { onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( onModelReady: (model2) => { - model2.getOffTime(), - model2.getReasons(offTime == '1' - ? 18 - : offTime == '2' - ? 19 - : 102), - model2.getCoveringDoctors() - }, + model2.getOffTime(), + model2.getReasons(offTime == '1' + ? 18 + : offTime == '2' + ? 19 + : 102), + model2.getCoveringDoctors() + }, builder: (_, model2, w) => GestureDetector( - onTap: () { - FocusScope.of(context).requestFocus(new FocusNode()); - }, - child: AppScaffold( - baseViewModel: model2, - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).rescheduleLeaves ?? "", - body: Center( - child: Container( - margin: EdgeInsets.only(top: 10), - child: FractionallySizedBox( - widthFactor: 0.9, - child: ListView( - children: [ - // Container( - // margin: EdgeInsets.all(8), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.all( - // Radius.circular(6.0)), - // border: Border.all( - // width: 1.0, - // color: HexColor("#CCCCCC"))), - // width: double.infinity, - // child: Padding( - // padding: EdgeInsets.only( - // top: SizeConfig.widthMultiplier * 0.9, - // bottom: - // SizeConfig.widthMultiplier * 0.9, - // right: SizeConfig.widthMultiplier * 3, - // left: SizeConfig.widthMultiplier * 3), - // child: Column( - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // Expanded( - // // add Expanded to have your dropdown button fill remaining space - // child: - // DropdownButtonHideUnderline( - // child: new IgnorePointer( - // ignoring: true, - // child: DropdownButton( - // focusColor: - // Colors.grey, - // isExpanded: true, - // dropdownColor: - // Colors.grey, - // value: getClinicName( - // model) ?? - // "", - // iconSize: 0, - // elevation: 16, - // selectedItemBuilder: - // (BuildContext - // context) { - // return model - // .getClinicNameList() - // .map((item) { - // return Row( - // mainAxisSize: - // MainAxisSize - // .max, - // children: < - // Widget>[ - // AppText( - // item, - // fontSize: - // SizeConfig.textMultiplier * - // 2.1, - // color: Colors - // .grey[ - // 500], - // ), - // ], - // ); - // }).toList(); - // }, - // onChanged: - // (newValue) => - // {}, - // items: model - // .getClinicNameList() - // .map((item) { - // return DropdownMenuItem( - // value: item - // .toString(), - // child: Text( - // item, - // textAlign: - // TextAlign - // .end, - // ), - // ); - // }).toList(), - // ))), - // ), - // ], - // ) - // ], - // ), - // )), + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( + baseViewModel: model2, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).rescheduleLeaves, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // width: double.infinity, + // child: Padding( + // padding: EdgeInsets.only( + // top: SizeConfig.widthMultiplier * 0.9, + // bottom: + // SizeConfig.widthMultiplier * 0.9, + // right: SizeConfig.widthMultiplier * 3, + // left: SizeConfig.widthMultiplier * 3), + // child: Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisSize: MainAxisSize.max, + // children: [ + // Expanded( + // // add Expanded to have your dropdown button fill remaining space + // child: + // DropdownButtonHideUnderline( + // child: new IgnorePointer( + // ignoring: true, + // child: DropdownButton( + // focusColor: + // Colors.grey, + // isExpanded: true, + // dropdownColor: + // Colors.grey, + // value: getClinicName( + // model) ?? + // "", + // iconSize: 0, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext + // context) { + // return model + // .getClinicNameList() + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize + // .max, + // children: < + // Widget>[ + // AppText( + // item, + // fontSize: + // SizeConfig.textMultiplier * + // 2.1, + // color: Colors + // .grey[ + // 500], + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: + // (newValue) => + // {}, + // items: model + // .getClinicNameList() + // .map((item) { + // return DropdownMenuItem( + // value: item + // .toString(), + // child: Text( + // item, + // textAlign: + // TextAlign + // .end, + // ), + // ); + // }).toList(), + // ))), + // ), + // ], + // ) + // ], + // ), + // )), - // Container( - // margin: EdgeInsets.all(8), - // decoration: BoxDecoration( - // borderRadius: - // BorderRadius.all(Radius.circular(6.0)), - // border: Border.all( - // width: 1.0, - // color: HexColor("#CCCCCC"))), - // padding: EdgeInsets.all(5), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // new IgnorePointer( - // ignoring: true, - // child: AppTextFormField( - // readOnly: true, - // hintText: profile != null - // ? profile['DoctorName'] - // : "", - // borderColor: Colors.white, - // onSaved: (value) {}, - // inputFormatter: ONLY_NUMBERS)) - // ], - // ), - // ), + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius.all(Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // padding: EdgeInsets.all(5), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // new IgnorePointer( + // ignoring: true, + // child: AppTextFormField( + // readOnly: true, + // hintText: profile != null + // ? profile['DoctorName'] + // : "", + // borderColor: Colors.white, + // onSaved: (value) {}, + // inputFormatter: ONLY_NUMBERS)) + // ], + // ), + // ), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allOffTime.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButtonHideUnderline( + child: DropdownButton( + // focusColor: Colors.grey, + isExpanded: true, + value: offTime == null ? model2.allOffTime[0]['code'] : offTime, + iconSize: 40, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model2.allOffTime.map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item['description'], + + fontSize: SizeConfig.textMultiplier * 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + setState(() { + offTime = newValue; + }); + if (offTime == '1') { + model2.getReasons(18); + } else if (offTime == '2') { + model2.getReasons(19); + } else if (offTime == '3' || offTime == '5') { + model2.getReasons(102); + setState(() { + offTime = newValue; + }); + } + }, + items: model2.allOffTime.map((item) { + return DropdownMenuItem( + value: item['code'].toString(), + child: Text( + item['description'], + textAlign: TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + offTime == '1' + ? Column( + children: [ Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.allOffTime.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - // focusColor: Colors.grey, - isExpanded: true, - value: offTime == null - ? model2.allOffTime[0]['code'].toString() - : offTime, - iconSize: 40, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return model2.allOffTime.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item['description'], - - fontSize: SizeConfig.textMultiplier * 2.1, - // color: - // Colors.grey, - ), - ], - ); - }).toList(); - }, - onChanged: (String? newValue) { - setState(() { - offTime = newValue; - }); - if (offTime == '1') { - model2.getReasons(18); - } else if (offTime == '2') { - model2.getReasons(19); - } else if (offTime == '3' || offTime == '5') { - model2.getReasons(102); - setState(() { - offTime = newValue; - }); - } - }, - items: model2.allOffTime.map((item) { - return DropdownMenuItem( - value: item['code'].toString(), - child: Text( - item['description'], - textAlign: TextAlign.end, - ), - ); - }).toList(), - )), - ) - : SizedBox(), - ], - ) - ], - ), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of(context).fromDate, + borderColor: Colors.white, + prefix: IconButton(icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker('fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (val) => fromDate = val, + onSaved: (val) => fromDate = val, + ) + ], )), - offTime == '1' - ? Column( - children: [ - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).fromDate, - borderColor: Colors.white, - prefix: - IconButton(onPressed: () {}, icon: Icon(Icons.calendar_today)), - textInputType: TextInputType.number, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (val) => fromDate = val, - onSaved: (val) => fromDate = val, - ) - ], - )), - Row( - children: [ - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DateTimePicker( - timeHintText: TranslationBase.of(context).fromTime, - type: DateTimePickerType.time, - controller: _controller4, - onChanged: (val) => fromTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => fromTime = val!, - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DateTimePicker( - timeHintText: TranslationBase.of(context).toTime, - type: DateTimePickerType.time, - controller: _controller5, - onChanged: (val) => toTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => toTime = val!, - ) - ], - ), - ), - ) - ], - ) - ], - ) - : Column( - children: [ - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).fromDate, - borderColor: Colors.white, - prefix: - IconButton(onPressed: () {}, icon: Icon(Icons.calendar_today)), - textInputType: TextInputType.number, - readOnly: true, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - setState(() { - fromDate = value; - }); - }), - ], - )), - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).toDate, - readOnly: true, - borderColor: Colors.white, - prefix: - IconButton(onPressed: () {}, icon: Icon(Icons.calendar_today)), - textInputType: TextInputType.number, - controller: _toDateController2, - onTap: () { - _presentDatePicker('toDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - setState(() { - toDate = value; - }); - }), - ], - )) - ], + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: TranslationBase.of(context).fromTime, + type: DateTimePickerType.time, + controller: _controller4, + onChanged: (val) => fromTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => fromTime = val, + ) + ], + ), ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: TranslationBase.of(context).toTime, + type: DateTimePickerType.time, + controller: _controller5, + onChanged: (val) => toTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => toTime = val, + ) + ], + ), + ), + ) + ], + ) + ], + ) + : Column( + children: [ Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.allReasons.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - focusColor: Colors.grey, - isExpanded: true, - value: model2.allReasons[0]['id'].toString() ?? "", - iconSize: 40, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return model2.allReasons.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - projectsProvider.isArabic - ? item['nameAr'] - : item['nameEn'], - fontSize: SizeConfig.textMultiplier * 2.1, - // color: - // Colors.grey, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - reason = newValue; - }) - }, - items: model2.allReasons.map((item) { - return DropdownMenuItem( - value: item['id'].toString(), - child: Text( - projectsProvider.isArabic ? item['nameAr'] : item['nameEn'], - textAlign: TextAlign.end, - ), - ); - }).toList(), - )), - ) - : SizedBox(), - ], - ) - ], - ), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of(context).fromDate, + borderColor: Colors.white, + prefix: IconButton(icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + readOnly: true, + controller: _toDateController, + onTap: () { + _presentDatePicker('fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + fromDate = value; + }); + }), + ], )), - Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.coveringDoctors.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownSearch( - mode: Mode.BOTTOM_SHEET, - - dropdownSearchDecoration: InputDecoration( - contentPadding: EdgeInsets.all(0), border: InputBorder.none), - //maxHeight: 300, - items: model2.coveringDoctors.map((item) { - return projectsProvider.isArabic - ? item['doctorNameN'].toString() - : item['doctorName'].toString(); - }).toList(), - // label: "Doctor List", - onChanged: (item) { - model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorName'] == item ) - doctorID = newVal['DoctorID']} - }); - }, - selectedItem: getSelectedDoctor(model2), - showSearchBox: true, - searchBoxDecoration: InputDecoration( - border: OutlineInputBorder(), - contentPadding: EdgeInsets.fromLTRB(12, 12, 8, 0), - labelText: "Search Doctor", - ), - popupTitle: Container( - height: 50, - decoration: BoxDecoration( - color: Theme.of(context).primaryColorDark, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - ), - ), - child: Center( - child: Text( - '', - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), - ), - popupShape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(24), - topRight: Radius.circular(24), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of(context).toDate, + readOnly: true, + borderColor: Colors.white, + prefix: IconButton(icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + controller: _toDateController2, + onTap: () { + _presentDatePicker('toDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )) + ], + ), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allReasons.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButtonHideUnderline( + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: model2.allReasons[0]['id'].toString() ?? "", + iconSize: 40, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model2.allReasons.map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + projectsProvider.isArabic + ? item['nameAr'] + : item['nameEn'], + fontSize: SizeConfig.textMultiplier * 2.1, + // color: + // Colors.grey, ), - ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + reason = newValue; + }) + }, + items: model2.allReasons.map((item) { + return DropdownMenuItem( + value: item['id'].toString(), + child: Text( + projectsProvider.isArabic ? item['nameAr'] : item['nameEn'], + textAlign: TextAlign.end, ), - // DropdownButtonHideUnderline( - // child: DropdownButton( - // focusColor: Colors.grey, - // isExpanded: true, - // value: doctorID == null - // ? model2 - // .coveringDoctors[0] - // ['doctorID'] - // .toString() - // : doctorID, - // iconSize: 40, - // elevation: 16, - // selectedItemBuilder: - // (BuildContext context) { - // return model2 - // .coveringDoctors - // .map((item) { - // return Row( - // mainAxisSize: - // MainAxisSize.max, - // children: [ - // AppText( - // projectsProvider - // .isArabic - // ? item[ - // 'doctorNameN'] - // : item[ - // 'doctorName'], - // fontSize: SizeConfig - // .textMultiplier * - // 2.1, - // ), - // ], - // ); - // }).toList(); - // }, - // onChanged: (newValue) => { - // setState(() { - // doctorID = newValue; - // }) - // }, - // items: model2 - // .coveringDoctors - // .map((item) { - // return DropdownMenuItem< - // String>( - // value: item['doctorID'] - // .toString(), - // child: Text( - // projectsProvider - // .isArabic - // ? item[ - // 'doctorNameN'] - // : item[ - // 'doctorName'], - // textAlign: - // TextAlign.start, - // ), - // ); - // }).toList(), - // )), - ) - : SizedBox(), - ], + ); + }).toList(), + )), ) + : SizedBox(), ], - ), - )), - SizedBox(height: SizeConfig.screenHeight * .3), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: widget.isUpdate == true - ? TranslationBase.of(context).updateReschedule - : TranslationBase.of(context).addReschedule, - color: HexColor('#359846'), - onPressed: () { - if (offTime == '1' || offTime == '2') { - if (widget.isUpdate == true) { - updateRecheduleLeave(model2); - } else { - addRecheduleLeave(model2); - } - } else { - DrAppToastMsg.showErrorToast(TranslationBase.of(context).onlyOfftimeHoliday); - } - }, - ), + ) ], ), - ), - // Column( - // children: [ - // AppText(TranslationBase.of(context) - // .previousSickLeaveIssue + - // ' ') - // ], - // ) - ], + )), + + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.coveringDoctors.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownSearch( + mode: Mode.BOTTOM_SHEET, + + dropdownSearchDecoration: InputDecoration( + contentPadding: EdgeInsets.all(0), border: InputBorder.none), + //maxHeight: 300, + items: model2.coveringDoctors.map((item) { + return projectsProvider.isArabic + ? item['doctorNameN'] + : item['doctorName']; + }).toList(), + // label: "Doctor List", + onChanged: (item) { + model2.coveringDoctors.forEach((newVal) => { + if (newVal['doctorName'] == item) + doctorID = newVal['DoctorID'] + }); + }, + selectedItem: getSelectedDoctor(model2), + showSearchBox: true, + searchBoxDecoration: InputDecoration( + border: OutlineInputBorder(), + contentPadding: EdgeInsets.fromLTRB(12, 12, 8, 0), + labelText: "Search Doctor", + ), + popupTitle: Container( + height: 50, + decoration: BoxDecoration( + color: Theme.of(context).primaryColorDark, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ), + ), + child: Center( + child: Text( + '', + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + ), + popupShape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(24), + topRight: Radius.circular(24), + ), + ), + ), + // DropdownButtonHideUnderline( + // child: DropdownButton( + // focusColor: Colors.grey, + // isExpanded: true, + // value: doctorID == null + // ? model2 + // .coveringDoctors[0] + // ['doctorID'] + // .toString() + // : doctorID, + // iconSize: 40, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext context) { + // return model2 + // .coveringDoctors + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize.max, + // children: [ + // AppText( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // fontSize: SizeConfig + // .textMultiplier * + // 2.1, + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: (newValue) => { + // setState(() { + // doctorID = newValue; + // }) + // }, + // items: model2 + // .coveringDoctors + // .map((item) { + // return DropdownMenuItem< + // String>( + // value: item['doctorID'] + // .toString(), + // child: Text( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // textAlign: + // TextAlign.start, + // ), + // ); + // }).toList(), + // )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + SizedBox(height: SizeConfig.screenHeight * .3), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isUpdate == true + ? TranslationBase.of(context).updateReschedule + : TranslationBase.of(context).addReschedule, + color: HexColor('#359846'), + onPressed: () { + if (offTime == '1' || offTime == '2') { + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } + } else { + DrAppToastMsg.showErrorToast(TranslationBase.of(context).onlyOfftimeHoliday); + } + }, + ), + ], + ), ), - ), + // Column( + // children: [ + // AppText(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], ), ), ), - ))); + ), + ), + ))); } getProfile() async { @@ -801,8 +796,8 @@ class _RescheduleLeaveScreen extends State { context, MaterialPageRoute( builder: (context) => AddRescheduleLeavScreen(), settings: RouteSettings(name: 'AddRescheduleLeaveScreen') - // MyReferredPatient(), - ), + // MyReferredPatient(), + ), ); } }); @@ -872,8 +867,8 @@ class _RescheduleLeaveScreen extends State { : model2.coveringDoctors[0]['doctorName']; else { model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorID'].toString() == doctorID) {doctorName = newVal['doctorName']} - }); + if (newVal['doctorID'].toString() == doctorID) {doctorName = newVal['doctorName']} + }); return doctorName; } } diff --git a/pubspec.lock b/pubspec.lock index f6841219..27ad91b3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "12.0.0" + version: "14.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.40.6" + version: "0.41.2" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "3.1.6" args: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.1" autocomplete_textfield: dependency: "direct main" description: @@ -43,6 +43,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.3" + badges: + dependency: "direct main" + description: + name: badges + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" barcode_scan_fix: dependency: "direct main" description: @@ -134,6 +141,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "8.1.0" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.1" characters: dependency: transitive description: @@ -147,7 +161,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" charts_common: dependency: transitive description: @@ -252,7 +266,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "3.0.1" csslib: dependency: transitive description: @@ -412,6 +426,20 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" flutter_colorpicker: dependency: "direct main" description: @@ -574,6 +602,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.4" + hijri: + dependency: transitive + description: + name: hijri + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" + hijri_picker: + dependency: "direct main" + description: + name: hijri_picker + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" html: dependency: "direct main" description: @@ -616,6 +658,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.8" imei_plugin: dependency: "direct main" description: @@ -692,7 +741,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mime: dependency: transitive description: @@ -735,6 +784,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.1" + octo_image: + dependency: transitive + description: + name: octo_image + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" package_config: dependency: transitive description: @@ -763,6 +819,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.2.1" + path_provider: + dependency: transitive + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.7" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" + path_provider_ios: + dependency: transitive + description: + name: path_provider_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" path_provider_linux: dependency: transitive description: @@ -770,6 +847,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" path_provider_platform_interface: dependency: transitive description: @@ -889,6 +973,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.1" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.25.0" scratch_space: dependency: transitive description: @@ -978,6 +1069,20 @@ packages: relative: true source: path version: "0.0.0" + sqflite: + dependency: transitive + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0+4" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1+1" stack_trace: dependency: transitive description: @@ -1013,6 +1118,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" term_glyph: dependency: transitive description: @@ -1026,7 +1138,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.2" timing: dependency: transitive description: @@ -1097,6 +1209,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.5" vector_math: dependency: transitive description: @@ -1217,5 +1336,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.13.0 <3.0.0" - flutter: ">=2.2.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0"