diff --git a/android/app/build.gradle b/android/app/build.gradle index dd7a2958..1aa8b742 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 29 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -39,8 +39,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.doctor_app_flutter" - minSdkVersion 16 - targetSdkVersion 28 + minSdkVersion 18 + targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1eb79e87..e6d9a9ad 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,6 +5,8 @@ In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + + UIViewControllerBasedStatusBarAppearance + NSCameraUsageDescription + Camera permission is required for barcode scanning. diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 20393d92..93575607 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -3,5 +3,13 @@ const Map> localizedValues = { 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, 'lanEnglish': {'en': 'English', 'ar': 'English'}, - 'lanArabic': {'en': 'العربية', 'ar': 'العربية'} + 'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, + 'doctorReply':{'en': 'Doctor Reply', 'ar': 'رد الطبيب'}, + 'time' :{'en': 'Time','ar':'الوقت'}, + 'fileNo' :{'en':'File No', 'ar':'رقم الملف'}, + 'mobileNo' :{'en':'Mobile No', 'ar':'رقم الموبايل'}, + 'messagesScreenToolbarTitle' : {'en': 'Messages','ar': 'الرسائل' }, + 'mySchedule' : {'en': 'My Schedule', 'ar' : 'جدولي'}, + 'errorNoSchedule' :{'en': 'You don\'t have any Schedule' , 'ar': 'ليس لديك أي جدول زمني'}, + }; diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index fd695c9c..2b2fd876 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -89,7 +89,7 @@ class PatiantInformtion { this.nursingStationName, this.appointmentDate, this.startTime, - + }); factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( @@ -125,7 +125,7 @@ class PatiantInformtion { age: json["Age"], genderDescription: json["GenderDescription"], nursingStationName: json["NursingStationName"], - appointmentDate: json["AppointmentDate"], + appointmentDate: json["AppointmentDate"]?? '', startTime: json["StartTime"], ); diff --git a/lib/models/patient/patient_model.dart b/lib/models/patient/patient_model.dart index 93e77c18..c6f4602d 100644 --- a/lib/models/patient/patient_model.dart +++ b/lib/models/patient/patient_model.dart @@ -144,6 +144,31 @@ class PatientModel { LastName: json["LasttName"], ); + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.ProjectID; + data['ClinicID'] = this.ClinicID; + data['DoctorID'] = this.DoctorID; + data['PatientID'] = this.PatientID; + data['FirstName'] = this.FirstName; + data['MiddleName'] = this.MiddleName; + data['LastName'] = this.LastName; + data['PatientMobileNumber'] = this.PatientMobileNumber; + data['PatientIdentificationID'] = this.PatientIdentificationID; + data['PatientID'] = this.PatientID; + data['From'] = this.From; + data['To'] = this.To; + data['LanguageID'] = this.LanguageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.IPAdress; + data['VersionID'] = this.VersionID; + data['Channel'] = this.Channel; + data['TokenID'] = this.TokenID; + data['SessionID'] = this.SessionID; + data['IsLoginForDoctorApp'] = this.IsLoginForDoctorApp; + data['PatientOutSA'] = this.PatientOutSA; + return data; + } } //*************************** \ No newline at end of file diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart index b67cba47..9572312f 100644 --- a/lib/providers/doctor_reply_provider.dart +++ b/lib/providers/doctor_reply_provider.dart @@ -1,6 +1,8 @@ import 'dart:convert'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/request_doctor_reply.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -26,6 +28,12 @@ class DoctorReplyProvider with ChangeNotifier { getDoctorSchedule() async { const url = BASE_URL + 'DoctorApplication.svc/REST/GtMyPatientsQuestions'; + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + String token = await sharedPref.getString(TOKEN); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + _requestSchedule.doctorID = doctorProfile.doctorID; + _requestSchedule.projectID = doctorProfile.projectID; + _requestSchedule.tokenID = token; try { if (await Helpers.checkConnection()) { final response = await client.post(url, @@ -45,7 +53,8 @@ class DoctorReplyProvider with ChangeNotifier { isLoading = false; } else { isError = true; - error = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage']; + isLoading = false; + error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'] ; } } } else { diff --git a/lib/providers/schedule_provider.dart b/lib/providers/schedule_provider.dart index edd880d2..44ed24de 100644 --- a/lib/providers/schedule_provider.dart +++ b/lib/providers/schedule_provider.dart @@ -1,6 +1,8 @@ import 'dart:convert'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart'; @@ -11,14 +13,14 @@ import '../models/list_doctor_working_hours_table_model.dart'; import '../models/request_schedule.dart'; class ScheduleProvider with ChangeNotifier { - Client client = - HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); + + Client client = HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); List listDoctorWorkingHoursTable = []; bool isLoading = true; bool isError = false; String error = ''; - RequestSchedule requestSchedule = RequestSchedule(15, 1, 70907, 7, 2, '2020-04-22T11:25:57.640Z', '11.11.11.11', 1.2, 9, '2lMDFT8U+Uy5jxRzCO8n2w==', 'vV6tg9yyVJ222', true, false, 1); + RequestSchedule requestSchedule = RequestSchedule(15, 1, 1485, 7, 2, '2020-04-22T11:25:57.640Z', '11.11.11.11', 1.2, 9, '2lMDFT8U+Uy5jxRzCO8n2w==', 'vV6tg9yyVJ222', true, false, 1); ScheduleProvider() { getDoctorSchedule(); @@ -26,6 +28,13 @@ class ScheduleProvider with ChangeNotifier { getDoctorSchedule() async { const url = BASE_URL + 'Doctors.svc/REST/GetDoctorWorkingHoursTable'; + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + String token = await sharedPref.getString(TOKEN); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + requestSchedule.doctorID = doctorProfile.doctorID; + requestSchedule.projectID = doctorProfile.projectID; + requestSchedule.clinicID = doctorProfile.clinicID; + requestSchedule.tokenID = token; try { if (await Helpers.checkConnection()) { diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 7a7baacf..71be8b75 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -1,11 +1,205 @@ +import 'package:barcode_scan/platform_wrapper.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; +import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class QrReaderScreen extends StatelessWidget { +import 'package:provider/provider.dart'; + +import '../routes.dart'; + +class QrReaderScreen extends StatefulWidget { + @override + _QrReaderScreenState createState() => _QrReaderScreenState(); +} + +class _QrReaderScreenState extends State { +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + + bool isLoading = false; + bool isError = false; + PatientModel patient = PatientModel( + ProjectID: 15, + ClinicID: 0, + DoctorID: 1485, + FirstName: "0", + MiddleName: "0", + LastName: "0", + PatientMobileNumber: "0", + PatientIdentificationID: "0", + PatientID: 0, + From: "0", + To: "0", + LanguageID: 2, + stamp: "2020-03-02T13:56:39.170Z", + IPAdress: "11.11.11.11", + VersionID: 1.2, + Channel: 9, + TokenID: "@dm!n", + SessionID: "5G0yXn0Jnq", + IsLoginForDoctorApp: true, + PatientOutSA: false); + List patientList = []; + String error = ''; + @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: "QR Reader", - body: Container(), + body: Center( + child: Container( + margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + AppText( + 'Start Scanning', + fontSize: 18, + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + ), + SizedBox( + height: 7, + ), + AppText( + 'scan Qr code to retrieve patient profile', + fontSize: 14, + fontWeight: FontWeight.w400, + textAlign: TextAlign.center + ), + SizedBox( + height: 15, + ), + Container( + height: 150, + child: Image.asset('assets/images/qr_code.png'), + ), + SizedBox( + height: 35, + ), + Button( + onTap: () { + _scanQrAndGetPatient(context); + }, + title: 'Scan Qr', + loading: isLoading, + icon: Image.asset('assets/images/qr_code_white.png'), + ), + isError ? Container( + margin: EdgeInsets.only(top: 8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Theme.of(context).errorColor.withOpacity(0.06), + ), + padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0), + child: Row( + children: [ + Expanded(child: AppText(error ?? "Something went wrong.", color: Theme.of(context).errorColor)), + ], + ), + ):Container(), + Column( + children: patientList.map((item) { + return InkWell( + onTap: (){ + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": item, + }); + }, + child: AnimatedContainer( + duration: Duration(milliseconds: 200), + child: CardWithBgWidget( + widget: Container( + child: AppText( + '${item.firstName} ${item.lastName}', + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + ), + ), + ), + ); + }).toList() + ), + + ], + ), + ), + ), + ), ); } -} \ No newline at end of file + + + _scanQrAndGetPatient(BuildContext context) async { + /// When give qr we will change this method to get data + /// var result = await BarcodeScanner.scan(); + /// int patientID = get from qr result + var result = await BarcodeScanner.scan(); + // if (result.rawContent == "") { + List listOfParams = result.rawContent.split(','); + String patientType = "1"; + setState(() { + isLoading = true; + isError = false; + patientList = []; + }); + String token = await sharedPref.getString(TOKEN); + patient.PatientID = 8808; + patient.TokenID = token; + Provider.of(context, listen: false) + .getPatientList(patient, "1") + .then((response) { + if (response['MessageStatus'] == 1) { + switch (patientType) { + case "0": + if (response['List_MyOutPatient'] != null) { + setState(() { + patientList = ModelResponse + .fromJson(response['List_MyOutPatient']) + .list; + isLoading = false; + }); + } else { + setState(() { + isError = true; + error = 'No patient'; + isLoading = false; + }); + } + break; + case "1": + if (response['List_MyInPatient'] != null) { + setState(() { + patientList = ModelResponse.fromJson(response['List_MyInPatient']).list; + isLoading = false; + error = ""; + }); + } else { + setState(() { + error = 'No patient'; + isError = true; + isLoading = false; + }); + break; + } + } + } else { + setState(() { + error = response['ErrorEndUserMessage'] ?? response['ErrorMessage'] ; + isLoading = false; + isError = true; + }); + } + }); + } + // } +} diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index ad200706..9f73feea 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/doctor_reply_provider.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'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; @@ -24,7 +25,7 @@ class DoctorReplyScreen extends StatelessWidget { Widget build(BuildContext context) { _doctorReplyProvider = Provider.of(context); return AppScaffold( - appBarTitle: 'Doctor Reply', + appBarTitle: TranslationBase.of(context).doctorReply, showAppDrawer: false, body:_doctorReplyProvider.isLoading? DrAppCircularProgressIndeicator(): _doctorReplyProvider.isError? Center( @@ -62,7 +63,7 @@ class DoctorReplyScreen extends StatelessWidget { Row( children: [ AppText( - 'Time', + TranslationBase.of(context).time, fontSize: 2.5 * SizeConfig.textMultiplier, ), Container( @@ -80,7 +81,7 @@ class DoctorReplyScreen extends StatelessWidget { Row( children: [ AppText( - 'File No', + TranslationBase.of(context).fileNo, fontSize: 2.5 * SizeConfig.textMultiplier, ), Container( @@ -98,7 +99,7 @@ class DoctorReplyScreen extends StatelessWidget { Row( children: [ AppText( - 'Mobile No', + TranslationBase.of(context).mobileNo, fontSize: 2.5 * SizeConfig.textMultiplier, ), Container( diff --git a/lib/screens/doctor/message_screen.dart b/lib/screens/doctor/message_screen.dart index 92eb61f3..1321c4fc 100644 --- a/lib/screens/doctor/message_screen.dart +++ b/lib/screens/doctor/message_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -6,7 +7,7 @@ class MessagesScreen extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( current: 1, - appBarTitle: 'Messages', + appBarTitle: TranslationBase.of(context).messagesScreenToolbarTitle, body: Center( child: Text('Messages heeer'), ), diff --git a/lib/screens/doctor/my_schedule_screen.dart b/lib/screens/doctor/my_schedule_screen.dart index f4627d6c..b9f60889 100644 --- a/lib/screens/doctor/my_schedule_screen.dart +++ b/lib/screens/doctor/my_schedule_screen.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/providers/schedule_provider.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; @@ -18,7 +19,7 @@ class MyScheduleScreen extends StatelessWidget { // pageOnly: false, showBottomBar: false, showAppDrawer: false, - appBarTitle: 'My Schedule', + appBarTitle: TranslationBase.of(context).mySchedule, body: scheduleProvider.isLoading ? DrAppCircularProgressIndeicator() : scheduleProvider.isError @@ -31,7 +32,7 @@ class MyScheduleScreen extends StatelessWidget { : scheduleProvider.listDoctorWorkingHoursTable.length == 0 ? Center( child: AppText( - 'You don\'t have any Schedule', + TranslationBase.of(context).errorNoSchedule, color: Theme.of(context).errorColor, ), ) @@ -48,7 +49,7 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 20, ), - AppText('My Schedule', + AppText(TranslationBase.of(context).mySchedule, fontSize: 2.5 * SizeConfig.textMultiplier), scheduleListByDate(), diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index b2d58854..914faf06 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -65,8 +65,7 @@ class _PatientSearchScreenState extends State { if (_formKey.currentState.validate()) { _formKey.currentState.save(); - //*********************************** */ - sharedPref.setString(TOKEN, '@dm!n'); + sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); print('_selectedType${_selectedType}'); String token = await sharedPref.getString(TOKEN); @@ -83,7 +82,6 @@ class _PatientSearchScreenState extends State { "selectedType": _selectedType }); } else { -// If all data are not valid then start auto validation. setState(() { _autoValidate = true; }); @@ -237,9 +235,7 @@ class _PatientSearchScreenState extends State { _patientSearchFormValues.setLastName = "0"; } }, - // validator: (value) { - // return TextValidator().validateName(value); - // }, + inputFormatter: ONLY_LETTERS), SizedBox( height: 10, @@ -269,7 +265,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Patiant ID', + hintText: 'Patient ID', // inputFormatter: ONLY_NUMBERS, onSaved: (value) { @@ -288,7 +284,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Patiant File', + hintText: 'Patient File', // validator: (value) { // return TextValidator().validateIdNumber(value); // }, diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 369c47cf..ebf33169 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -17,14 +17,11 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; -//************* import '../../config/size_config.dart'; import 'package:hexcolor/hexcolor.dart'; -//******** import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/card_with_bg_widget.dart'; @@ -37,15 +34,16 @@ class PatientsScreen extends StatefulWidget { class _PatientsScreenState extends State { List litems; - // final List parsed; + List parsed; - //********** + List date; List unfilterDate; - //*********** + List responseModelList; List responseModelList2; + // List _locations = ['Today', 'Old Date', 'YESTERDAY']; List _locations = ['Today', 'Tomorrow', 'Next Week']; int _activeLocation = 0; @@ -53,12 +51,13 @@ class _PatientsScreenState extends State { bool _isInit = true; String patientType; String patientTypetitle; - var _isLoading = true; + var _isLoading = false; + + bool _isError = true; + String error = ""; - var _hasError; - //*******Amjad add to search box****** final _controller = TextEditingController(); - //************** + PatientModel patient; PatientsProvider patientsProv; @@ -68,8 +67,6 @@ class _PatientsScreenState extends State { patient = routeArgs['patientSearchForm']; - print(patient.TokenID + "EEEEEE"); - patientType = routeArgs['selectedType']; patientTypetitle = SERVICES_PATIANT_HEADER[int.parse(patientType)]; @@ -77,26 +74,31 @@ class _PatientsScreenState extends State { if (_isInit) { PatientsProvider patientsProv = Provider.of(context); + setState(() { + _isLoading = true; + _isError = false; + error = ""; + }); patientsProv.getPatientList(patient, patientType).then((res) { setState(() { - int val2 = int.parse(patientType); - litems = res[SERVICES_PATIANT2[val2]]; - - parsed = litems; - - responseModelList = new ModelResponse.fromJson(parsed).list; - responseModelList2 = responseModelList; - //******************** _isLoading = false; - - _hasError = res['ErrorEndUserMessage']; + if (res['MessageStatus'] == 1) { + int val2 = int.parse(patientType); + litems = res[SERVICES_PATIANT2[val2]]; + parsed = litems; + responseModelList = new ModelResponse.fromJson(parsed).list; + responseModelList2 = responseModelList; + _isError = false; + } else { + _isError = true; + error = res['ErrorEndUserMessage'] ?? res['ErrorMessage'] ; + } }); - print(res); }).catchError((error) { - // patientsProv.isLoading=false; - // patientsProv.isError=true; - print("====================error================"); - print(error); + setState(() { + _isError = true; + this.error = helpers.generateContactAdminMsg(error); + }); }); } @@ -106,7 +108,7 @@ class _PatientsScreenState extends State { } /* - *@author: Amjad Amireh + *@author: Amjad Amireh *@Date:2/5/2020 *@param: *@return:PatientsScreen Search textbox filter @@ -139,9 +141,8 @@ class _PatientsScreenState extends State { } } -//***********DateFormat************** /* - *@author: Amjad Amireh + *@author: Amjad Amireh *@Date:5/5/2020 *@param: *@return:Convert time from Milesecond to date with time @@ -177,10 +178,10 @@ class _PatientsScreenState extends State { } /* - *@author: Amjad Amireh + *@author: Amjad Amireh *@Date:5/5/2020 *@param: - *@return:Convert time from Milesecond to date + *@return:Convert time from Milesecond to date *@desc: */ @@ -202,7 +203,8 @@ class _PatientsScreenState extends State { return newDate.toString(); } - convertDateFormat2(String str) { + + convertDateFormat2(String str) { String timeConvert; const start = "/Date("; const end = "+0300)"; @@ -220,6 +222,7 @@ class _PatientsScreenState extends State { return newDate.toString(); } + filterBooking(String str) { this.responseModelList = this.responseModelList2; @@ -273,29 +276,23 @@ class _PatientsScreenState extends State { return "Old Date"; } -//************************* @override Widget build(BuildContext context) { PatientsProvider patientsProv = Provider.of(context); return AppScaffold( - appBarTitle: patientTypetitle, - //***********Modify by amjad (create List view to insert all new data webservise in scroll )************* - body: patientsProv.isLoading - ? DrAppCircularProgressIndeicator() - : patientsProv.isError - ? DrAppEmbeddedError(error: patientsProv.error) - : litems == null? - // ? DrAppEmbeddedError( - // error: 'You don\'t have any ' + - // patientTypetitle + - // " patiant") - DrAppCircularProgressIndeicator() - : Container( - child: - ListView(scrollDirection: Axis.vertical, children: < - Widget>[ - Container( + appBarTitle: patientTypetitle, + body: _isLoading + ? DrAppCircularProgressIndeicator() + : _isError + ? DrAppEmbeddedError(error: error) + : litems == null + ? DrAppEmbeddedError(error: 'You don\'t have any patient') + : Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( child: litems == null ? Column( children: [ @@ -333,7 +330,7 @@ class _PatientsScreenState extends State { this.searchData(str); }, decoration: buildInputDecoration( - context, 'Search patiant'), + context, 'Search Patient'), ), ), Container( @@ -368,11 +365,13 @@ class _PatientsScreenState extends State { patientType)] == "List_MyOutPatient" ? AppText( - convertDateFormat2(item - .appointmentDate - .toString())+" "+"-"+" "+item.startTime - , + .appointmentDate + .toString()) + + " " + + "-" + + " " + + item.startTime, fontSize: 2.5 * SizeConfig .textMultiplier) @@ -397,11 +396,14 @@ class _PatientsScreenState extends State { ), ), ], - )) - ]))); + ), + ) + ], + ), + ), + ); } - //***********amjad update**buildInputDecoration ***to search box******** InputDecoration buildInputDecoration(BuildContext context, hint) { return InputDecoration( prefixIcon: Icon(Icons.search, color: Colors.red), @@ -421,45 +423,46 @@ class _PatientsScreenState extends State { Widget _locationBar(BuildContext _context) { return Container( - height: MediaQuery.of(context).size.height * 0.065, - width: SizeConfig.screenWidth * 0.80, - decoration: BoxDecoration( - color: Color(0Xff59434f), borderRadius: BorderRadius.circular(20)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _locations.map((item) { - bool _isActive = _locations[_activeLocation] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Text( - item, - style: TextStyle( - fontSize: 15, - color: Colors.white, - fontWeight: FontWeight.bold), - ), - onTap: () { - print(_locations.indexOf(item)); - - filterBooking(item.toString()); - - setState(() { - _activeLocation = _locations.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - height: 3, - width: 80, - ) - : Container() - ]); - }).toList(), - )); + height: MediaQuery.of(context).size.height * 0.065, + width: SizeConfig.screenWidth * 0.80, + decoration: BoxDecoration( + color: Color(0Xff59434f), borderRadius: BorderRadius.circular(20)), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: _locations.map((item) { + bool _isActive = _locations[_activeLocation] == item ? true : false; + return Column(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + child: Text( + item, + style: TextStyle( + fontSize: 15, + color: Colors.white, + fontWeight: FontWeight.bold), + ), + onTap: () { + print(_locations.indexOf(item)); + + filterBooking(item.toString()); + + setState(() { + _activeLocation = _locations.indexOf(item); + }); + }), + _isActive + ? Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white), + height: 3, + width: 80, + ) + : Container() + ]); + }).toList(), + ), + ); } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 1af735a1..b5f75602 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -25,6 +25,21 @@ class TranslationBase { String get lanArabic => localizedValues['lanArabic'][locale.languageCode]; + String get doctorReply => localizedValues['doctorReply'][locale.languageCode]; + + String get time => localizedValues['time'][locale.languageCode]; + + String get fileNo => localizedValues['fileNo'][locale.languageCode]; + + String get mobileNo => localizedValues['mobileNo'][locale.languageCode]; + + String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; + + String get mySchedule => localizedValues['mySchedule'][locale.languageCode]; + + String get errorNoSchedule => localizedValues['errorNoSchedule'][locale.languageCode]; + + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/app_button.dart b/lib/widgets/shared/app_button.dart new file mode 100644 index 00000000..522255df --- /dev/null +++ b/lib/widgets/shared/app_button.dart @@ -0,0 +1,146 @@ +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class Button extends StatefulWidget { + Button({ + Key key, + this.title: "", + this.icon, + this.onTap, + this.loading: false, + }) : super(key: key); + + final String title; + final Widget icon; + final VoidCallback onTap; + final bool loading; + + @override + _ButtonState createState() => _ButtonState(); +} + +class _ButtonState extends State