From cfd5b2ccff647bab7fcc8f9ff11fb77717ef06bf Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 10 Aug 2020 17:42:58 +0300 Subject: [PATCH] feedback Service done --- lib/config/config.dart | 5 + lib/core/model/feedback/COC_items.dart | 120 ++++ .../feedback/request_insert_coc_item.dart | 132 +++++ .../service/feedback/feedback_service.dart | 65 ++ .../feedback/feedback_view_model.dart | 46 ++ .../viewModels/medical/labs_view_model.dart | 4 - .../medical/prescriptions_view_model.dart | 1 - .../medical/radiology_view_model.dart | 7 - lib/locator.dart | 4 + lib/pages/feedback/Status_feedback_page.dart | 98 +++ lib/pages/feedback/feedback_home_page.dart | 118 ++++ lib/pages/feedback/send_feedback_page.dart | 561 ++++++++++++++++++ lib/pages/landing/home_page.dart | 76 +-- lib/pages/landing/landing_page.dart | 15 +- .../medical/doctor/doctor_home_page.dart | 2 - lib/pages/medical/medical_profile_page.dart | 2 - .../pharmacy_for_prescriptions_page.dart | 2 +- .../prescriptions_history_details_page.dart | 1 - lib/widgets/bottom_options/BottomSheet.dart | 141 +++++ lib/widgets/input/text_field.dart | 9 +- 20 files changed, 1342 insertions(+), 67 deletions(-) create mode 100644 lib/core/model/feedback/COC_items.dart create mode 100644 lib/core/model/feedback/request_insert_coc_item.dart create mode 100644 lib/core/service/feedback/feedback_service.dart create mode 100644 lib/core/viewModels/feedback/feedback_view_model.dart create mode 100644 lib/pages/feedback/Status_feedback_page.dart create mode 100644 lib/pages/feedback/feedback_home_page.dart create mode 100644 lib/pages/feedback/send_feedback_page.dart create mode 100644 lib/widgets/bottom_options/BottomSheet.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 361f6350..7c9874d2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -30,6 +30,11 @@ const GET_PATIENT_ORDERS_DETAILS = '/Patients.svc/REST/Rad_UpdatePatientRadOrder const GET_RAD_IMAGE_URL = '/Patients.svc/Rest/GetRadImageURL'; const SEND_RAD_REPORT_EMAIL = '/Notifications.svc/REST/SendRadReportEmail'; + +///Feedback +const SEND_FEEDBACK = '/COCWS.svc/REST/InsertCOCItemInSPList'; +const GET_STATUS_FOR_COCO = '/COCWS.svc/REST/GetStatusforCOC'; + //const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment //const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment diff --git a/lib/core/model/feedback/COC_items.dart b/lib/core/model/feedback/COC_items.dart new file mode 100644 index 00000000..068c8bee --- /dev/null +++ b/lib/core/model/feedback/COC_items.dart @@ -0,0 +1,120 @@ +class COCItem { + Null appointment; + String appointmentClinicName; + String appointmentDate; + String appointmentProjectName; + String cOCID; + String cOCTitle; + String channel; + dynamic clinic; + String clinicID; + String date; + dynamic detail; + dynamic doctor; + String doctorID; + String formType; + int formTypeID; + dynamic identificationNo; + int itemID; + dynamic mobileNo; + dynamic naturename; + dynamic patientID; + dynamic patientName; + dynamic project; + dynamic projectID; + String solution; + String status; + String statusAr; + dynamic statusEn; + + COCItem( + {this.appointment, + this.appointmentClinicName, + this.appointmentDate, + this.appointmentProjectName, + this.cOCID, + this.cOCTitle, + this.channel, + this.clinic, + this.clinicID, + this.date, + this.detail, + this.doctor, + this.doctorID, + this.formType, + this.formTypeID, + this.identificationNo, + this.itemID, + this.mobileNo, + this.naturename, + this.patientID, + this.patientName, + this.project, + this.projectID, + this.solution, + this.status, + this.statusAr, + this.statusEn}); + + COCItem.fromJson(Map json) { + appointment = json['Appointment']; + appointmentClinicName = json['AppointmentClinicName']; + appointmentDate = json['AppointmentDate']; + appointmentProjectName = json['AppointmentProjectName']; + cOCID = json['COCID']; + cOCTitle = json['COCTitle']; + channel = json['Channel']; + clinic = json['Clinic']; + clinicID = json['ClinicID']; + date = json['Date']; + detail = json['Detail']; + doctor = json['Doctor']; + doctorID = json['DoctorID']; + formType = json['FormType']; + formTypeID = json['FormTypeID']; + identificationNo = json['IdentificationNo']; + itemID = json['ItemID']; + mobileNo = json['MobileNo']; + naturename = json['Naturename']; + patientID = json['PatientID']; + patientName = json['PatientName']; + project = json['Project']; + projectID = json['ProjectID']; + solution = json['Solution']; + status = json['Status']; + statusAr = json['StatusAr']; + statusEn = json['StatusEn']; + } + + Map toJson() { + final Map data = new Map(); + data['Appointment'] = this.appointment; + data['AppointmentClinicName'] = this.appointmentClinicName; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentProjectName'] = this.appointmentProjectName; + data['COCID'] = this.cOCID; + data['COCTitle'] = this.cOCTitle; + data['Channel'] = this.channel; + data['Clinic'] = this.clinic; + data['ClinicID'] = this.clinicID; + data['Date'] = this.date; + data['Detail'] = this.detail; + data['Doctor'] = this.doctor; + data['DoctorID'] = this.doctorID; + data['FormType'] = this.formType; + data['FormTypeID'] = this.formTypeID; + data['IdentificationNo'] = this.identificationNo; + data['ItemID'] = this.itemID; + data['MobileNo'] = this.mobileNo; + data['Naturename'] = this.naturename; + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['Project'] = this.project; + data['ProjectID'] = this.projectID; + data['Solution'] = this.solution; + data['Status'] = this.status; + data['StatusAr'] = this.statusAr; + data['StatusEn'] = this.statusEn; + return data; + } +} diff --git a/lib/core/model/feedback/request_insert_coc_item.dart b/lib/core/model/feedback/request_insert_coc_item.dart new file mode 100644 index 00000000..e8b6fce5 --- /dev/null +++ b/lib/core/model/feedback/request_insert_coc_item.dart @@ -0,0 +1,132 @@ +class RequestInsertCOCItem { + bool isUserLoggedIn; + String mobileNo; + int identificationNo; + int patientID; + int patientOutSA; + int patientTypeID; + String tokenID; + String patientName; + int projectID; + String fileName; + String attachment; + String uILanguage; + String browserInfo; + String cOCTypeName; + String formTypeID; + String details; + String deviceInfo; + String deviceType; + String title; + String resolution; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientType; + double appVersion; + + RequestInsertCOCItem( + {this.isUserLoggedIn, + this.mobileNo, + this.identificationNo, + this.patientID, + this.patientOutSA, + this.patientTypeID, + this.tokenID, + this.patientName, + this.projectID, + this.fileName, + this.attachment, + this.uILanguage, + this.browserInfo, + this.cOCTypeName, + this.formTypeID, + this.details, + this.deviceInfo, + this.deviceType, + this.title, + this.resolution, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientType, + this.appVersion}); + + RequestInsertCOCItem.fromJson(Map json) { + isUserLoggedIn = json['IsUserLoggedIn']; + mobileNo = json['MobileNo']; + identificationNo = json['IdentificationNo']; + patientID = json['PatientID']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + tokenID = json['TokenID']; + patientName = json['PatientName']; + projectID = json['ProjectID']; + fileName = json['FileName']; + attachment = json['Attachment']; + uILanguage = json['UILanguage']; + browserInfo = json['BrowserInfo']; + cOCTypeName = json['COCTypeName']; + formTypeID = json['FormTypeID']; + details = json['Details']; + deviceInfo = json['DeviceInfo']; + deviceType = json['DeviceType']; + title = json['Title']; + resolution = json['Resolution']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientType = json['PatientType']; + appVersion = json['AppVersion']; + } + + Map toJson() { + final Map data = new Map(); + data['IsUserLoggedIn'] = this.isUserLoggedIn; + data['MobileNo'] = this.mobileNo; + data['IdentificationNo'] = this.identificationNo; + data['PatientID'] = this.patientID; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + data['TokenID'] = this.tokenID; + data['PatientName'] = this.patientName; + data['ProjectID'] = this.projectID; + data['FileName'] = this.fileName; + data['Attachment'] = this.attachment; + data['UILanguage'] = this.uILanguage; + data['BrowserInfo'] = this.browserInfo; + data['COCTypeName'] = this.cOCTypeName; + data['FormTypeID'] = this.formTypeID; + data['Details'] = this.details; + data['DeviceInfo'] = this.deviceInfo; + data['DeviceType'] = this.deviceType; + data['Title'] = this.title; + data['Resolution'] = this.resolution; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientType'] = this.patientType; + data['AppVersion'] = this.appVersion; + return data; + } +} diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart new file mode 100644 index 00000000..eaf2f94a --- /dev/null +++ b/lib/core/service/feedback/feedback_service.dart @@ -0,0 +1,65 @@ +import 'dart:io'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; +import 'package:diplomaticquarterapp/core/model/feedback/request_insert_coc_item.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class FeedbackService extends BaseService { + List cOCItemList = List(); + RequestInsertCOCItem _requestInsertCOCItem = RequestInsertCOCItem(); + + Future sendCOCItem( + {String title, + String details, + String cOCTypeName, + String attachment}) async { + hasError = false; + + _requestInsertCOCItem.attachment = attachment; + _requestInsertCOCItem.title = title; + _requestInsertCOCItem.details = details; + _requestInsertCOCItem.cOCTypeName = cOCTypeName; + _requestInsertCOCItem.formTypeID = cOCTypeName; + _requestInsertCOCItem.mobileNo = + "966537503378"; //TODO Change it to be dynamic + _requestInsertCOCItem.isUserLoggedIn = true; + _requestInsertCOCItem.projectID = 1231755; + _requestInsertCOCItem.patientName = "TAMER FANASHEH"; + _requestInsertCOCItem.fileName = ""; + _requestInsertCOCItem.uILanguage = "ar"; //TODO Change it to be dynamic + _requestInsertCOCItem.browserInfo = Platform.localHostname; + _requestInsertCOCItem.deviceInfo = Platform.localHostname; + _requestInsertCOCItem.resolution = "400x847"; + _requestInsertCOCItem.projectID = 0; + _requestInsertCOCItem.identificationNo = 2344670985; + + await baseAppClient + .post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestInsertCOCItem.toJson()); + } + + Future getStatusCOC() async { + hasError = false; + Map body = new Map(); + body['IdentificationNo'] = '2344670985'; + body['MobileNo'] = '966537503378'; + body['Searching_type'] = '1'; + + await baseAppClient.post(GET_STATUS_FOR_COCO, + onSuccess: (dynamic response, int statusCode) { + cOCItemList = []; + response['ListCOCItems'].forEach((cOC) { + cOCItemList.add(COCItem.fromJson(cOC)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/feedback/feedback_view_model.dart b/lib/core/viewModels/feedback/feedback_view_model.dart new file mode 100644 index 00000000..e09d0747 --- /dev/null +++ b/lib/core/viewModels/feedback/feedback_view_model.dart @@ -0,0 +1,46 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; +import 'package:diplomaticquarterapp/core/service/feedback/feedback_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + +import '../../../locator.dart'; + +class FeedbackViewModel extends BaseViewModel { + FeedbackService _feedbackService = locator(); + + List get cOCItemList => _feedbackService.cOCItemList; + + Future sendCOCItem( + {String title, + String details, + String cOCTypeName, + String attachment}) async { + setState(ViewState.BusyLocal); + await _feedbackService.sendCOCItem( + title: title, + details: details, + cOCTypeName: cOCTypeName, + attachment: attachment); + if (_feedbackService.hasError) { + error = _feedbackService.error; + setState(ViewState.ErrorLocal); + return false; + } else { + getCOC(); + setState(ViewState.Idle); + return true; + } + } + + getCOC({bool call = true}) async { + setState(ViewState.Busy); + await _feedbackService.getStatusCOC(); + if (_feedbackService.hasError) { + error = _feedbackService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + + } +} diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 260870ac..1efdfb7c 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -1,13 +1,9 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/doctor/doctor_profile.dart'; -import 'package:diplomaticquarterapp/core/model/doctor/doctor_rating.dart'; -import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; -import 'package:diplomaticquarterapp/core/service/medical/my_doctor_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 125bee66..f67df015 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -8,7 +8,6 @@ import '../../../core/enum/filter_type.dart'; import '../../../core/enum/viewstate.dart'; import '../../../core/model/prescriptions/Prescriptions.dart'; import '../../../core/service/medical/prescriptions_service.dart'; - import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/core/viewModels/medical/radiology_view_model.dart b/lib/core/viewModels/medical/radiology_view_model.dart index b32308bf..26d40361 100644 --- a/lib/core/viewModels/medical/radiology_view_model.dart +++ b/lib/core/viewModels/medical/radiology_view_model.dart @@ -1,13 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/doctor/doctor_profile.dart'; -import 'package:diplomaticquarterapp/core/model/doctor/doctor_rating.dart'; -import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; -import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; -import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; -import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; -import 'package:diplomaticquarterapp/core/service/medical/my_doctor_service.dart'; import 'package:diplomaticquarterapp/core/service/medical/radiology_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; diff --git a/lib/locator.dart b/lib/locator.dart index c2c70183..edccda80 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,11 +1,13 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:get_it/get_it.dart'; +import 'core/service/feedback/feedback_service.dart'; import 'core/service/hospital_service.dart'; import 'core/service/medical/labs_service.dart'; import 'core/service/medical/my_doctor_service.dart'; import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; +import 'core/viewModels/feedback/feedback_view_model.dart'; import 'core/viewModels/hospital_view_model.dart'; import 'core/viewModels/medical/labs_view_model.dart'; import 'core/viewModels/medical/my_doctor_view_model.dart'; @@ -25,6 +27,7 @@ void setupLocator() { locator.registerLazySingleton(() => PrescriptionsService()); locator.registerLazySingleton(() => LabsService()); locator.registerLazySingleton(() => RadiologyService()); + locator.registerLazySingleton(() => FeedbackService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -33,5 +36,6 @@ void setupLocator() { locator.registerFactory(() => PrescriptionsViewModel()); locator.registerFactory(() => LabsViewModel()); locator.registerFactory(() => RadiologyViewModel()); + locator.registerFactory(() => FeedbackViewModel()); } diff --git a/lib/pages/feedback/Status_feedback_page.dart b/lib/pages/feedback/Status_feedback_page.dart new file mode 100644 index 00000000..4db732f9 --- /dev/null +++ b/lib/pages/feedback/Status_feedback_page.dart @@ -0,0 +1,98 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class StatusFeedbackPage extends StatefulWidget { + @override + _StatusFeedbackPageState createState() => _StatusFeedbackPageState(); +} + +class _StatusFeedbackPageState extends State { + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getCOC(), + builder: (_, model, widget) => AppScaffold( + baseViewModel: model, + body: Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.all(15.0), + child: ListView.builder( + itemCount: model.cOCItemList.length, + itemBuilder: (context, index) => Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(color: Colors.white, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.white, + ), + margin: EdgeInsets.all(4), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 8,), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts('${model.cOCItemList[index].cOCTitle}'), + Texts( + 'Number :${model.cOCItemList[index].itemID}', + variant: 'overline', + ), + ], + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts('${model.cOCItemList[index].status}'), + Texts( + '${model.cOCItemList[index].date}', + variant: 'overline', + ), + ], + ), + ], + ), + Texts('${model.cOCItemList[index].formType}'), + Divider(height: 4.5,color: Colors.grey[500],) + ], + ), + ), + )), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.13, + width: double.infinity, + padding: EdgeInsets.all(8.0), + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Search', + loading: model.state == ViewState.BusyLocal, + onTap: () { + //TODO When come back + }, + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/feedback/feedback_home_page.dart b/lib/pages/feedback/feedback_home_page.dart new file mode 100644 index 00000000..92bfaff7 --- /dev/null +++ b/lib/pages/feedback/feedback_home_page.dart @@ -0,0 +1,118 @@ +import 'dart:ui'; + +import 'package:diplomaticquarterapp/pages/feedback/send_feedback_page.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'Status_feedback_page.dart'; + +class FeedbackHomePage extends StatefulWidget { + @override + _FeedbackHomePageState createState() => _FeedbackHomePageState(); +} + +class _FeedbackHomePageState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Feedback', + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Stack( + children: [ + Positioned( + bottom: 1, + left: 0, + right: 0, + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Container( + color: Theme.of(context) + .scaffoldBackgroundColor + .withOpacity(0.8), + height: 70.0, + ), + ), + ), + Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.7), + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: true, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.label, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: Texts('Send'), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.30, + child: Center( + child: Texts('Status'), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + SendFeedbackPage(), + StatusFeedbackPage() + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart new file mode 100644 index 00000000..d0f01ddd --- /dev/null +++ b/lib/pages/feedback/send_feedback_page.dart @@ -0,0 +1,561 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +enum MessageType { + ComplaintOnAnAppointment, + ComplaintWithoutAppointment, + Question, + Compliment, + Suggestion, + NON +} + +class SendFeedbackPage extends StatefulWidget { + @override + _SendFeedbackPageState createState() => _SendFeedbackPageState(); +} + +class _SendFeedbackPageState extends State { + TextEditingController titleController = TextEditingController(); + TextEditingController messageController = TextEditingController(); + MessageType messageType = MessageType.NON; + String _selected = "not selected"; + List images = []; + String title; + + String message; + final formKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, widget) => AppScaffold( + baseViewModel: model, + body: Container( + height: MediaQuery.of(context).size.height * 0.8, + child: SingleChildScrollView( + child: Form( + key: formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 65, + ), + Container( + margin: EdgeInsets.only(left: 20, right: 20, top: 8), + child: Texts( + 'We\'d love to hear your feedback about the health care services and online services. Please fill in the required fields', + //يسعدنا سماع ملاحظاتك حول خدمات الرعاية الصحية والخدمات الإلكترونية. يرجى تعبئة الحقول المطلوبة + textAlign: TextAlign.center, + variant: 'body2Link', + ), + ), + InkWell( + onTap: () { + confirmBox(); + }, + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + height: 50, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(7), + color: Colors.white, + shape: BoxShape.rectangle, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Texts( + _selected, + variant: 'bodyText', + ), + margin: EdgeInsets.only(left: 10), + ), + Icon( + Icons.arrow_drop_down, + size: 22, + color: Colors.grey, + ) + ], + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: 'Title', + controller: titleController, + fontSize: 13.5, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + validator: (value) { + if (value == null) + return "please Enter title"; + else + return null; + }, + ), + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: 'message', + fontSize: 13.5, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: messageController, + validator: (value) { + if (value == null) + return "please Enter message"; + else + return null; + }), + ), + InkWell( + onTap: () { + ImageOptions.showImageOptions(context, (String image) { + setState(() { + images.add(image); + }); + }); + }, + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + height: 50, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(7), + color: Colors.white, + shape: BoxShape.rectangle, + ), + child: Center( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.attach_file), + Texts( + 'selected attachment', + variant: 'bodyText', + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ), + ...List.generate( + images.length, + (index) => Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon(FontAwesomeIcons.paperclip), + SizedBox( + width: 8, + ), + Texts( + 'image ${index + 1}.png', + ), + ], + ), + InkWell( + onTap: () { + setState(() { + images.remove(images[index]); + }); + }, + child: Icon( + FontAwesomeIcons.trashAlt, + color: Colors.red[300], + )) + ], + ), + )), + SizedBox( + height: 30, + ), + ], + ), + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.13, + width: double.infinity, + padding: EdgeInsets.all(8.0), + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Send', + loading: model.state == ViewState.BusyLocal, + onTap: () { + final form = formKey.currentState; + if (form.validate()) if (messageType != MessageType.NON) + model + .sendCOCItem( + title: titleController.text, + attachment: images.length > 0 ? images[0] : "", + details: messageController.text, + cOCTypeName: getCOCName()) + .then((value) { + if (value) { + setState(() { + titleController.text = ""; + messageController.text = ""; + }); + AppToast.showSuccessToast(message: "Your feedback was sended"); + + } else { + AppToast.showErrorToast(message: model.error); + + } + }); + else { + AppToast.showErrorToast(message: "Please select COC"); + } + }, + ), + ), + ), + ), + ), + ); + } + + String getCOCName() { + switch (messageType) { + case MessageType.ComplaintOnAnAppointment: + return "1"; + break; + case MessageType.ComplaintWithoutAppointment: + return "2"; + break; + case MessageType.Question: + return "3"; + break; + case MessageType.Compliment: + return "4"; + break; + case MessageType.Suggestion: + return "5"; + break; + case MessageType.NON: + return ""; + break; + } + return ""; + } + + // Show Dialog function + void confirmBox() { + showDialog( + context: context, + child: FeedbackTypeDialog( + onValueChange: _onValueChange, + initialValue: messageType, + onValueSelected: () { + setState(() { + switch (messageType) { + case MessageType.ComplaintOnAnAppointment: + _selected = "Complaint on an appointment"; + break; + case MessageType.ComplaintWithoutAppointment: + _selected = "Complaint without appointment"; + break; + case MessageType.Question: + _selected = "Question"; + break; + case MessageType.Compliment: + _selected = "Compliment"; + break; + case MessageType.Suggestion: + _selected = "Suggestion"; + break; + case MessageType.NON: + break; + } + }); + Navigator.pop(context); + }, + )); + } + + void _onValueChange(MessageType value) { + setState(() { + messageType = value; + }); + } +} + +class FeedbackTypeDialog extends StatefulWidget { + const FeedbackTypeDialog( + {this.onValueChange, this.initialValue, this.onValueSelected}); + + final MessageType initialValue; + final void Function(MessageType) onValueChange; + final GestureTapCallback onValueSelected; + + @override + State createState() => new FeedbackTypeDialogState(); +} + +class FeedbackTypeDialogState extends State { + MessageType _messageType; + + @override + void initState() { + super.initState(); + _messageType = widget.initialValue; + } + + Widget build(BuildContext context) { + return new SimpleDialog( + title: Text( + "Message Type", + textAlign: TextAlign.center, + ), + children: [ + Container( + // padding: const EdgeInsets.all(10.0), + child: Column( + children: [ + Divider( + height: 2.5, + color: Colors.grey[500], + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _messageType = MessageType.ComplaintOnAnAppointment; + widget.onValueChange(_messageType); + }); + }, + child: ListTile( + title: const Text('Complaint on an appointment'), + leading: Radio( + value: MessageType.ComplaintOnAnAppointment, + groupValue: _messageType, + activeColor: Colors.red[800], + onChanged: (MessageType value) { + setState(() { + _messageType = MessageType.ComplaintOnAnAppointment; + widget.onValueChange(_messageType); + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _messageType = MessageType.ComplaintWithoutAppointment; + widget.onValueChange(_messageType); + }); + }, + child: ListTile( + title: const Text('Complaint without appointment'), + leading: Radio( + value: MessageType.ComplaintWithoutAppointment, + groupValue: _messageType, + activeColor: Colors.red[800], + onChanged: (MessageType value) { + setState(() { + _messageType = + MessageType.ComplaintWithoutAppointment; + widget.onValueChange(_messageType); + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _messageType = MessageType.Question; + widget.onValueChange(_messageType); + }); + }, + child: ListTile( + title: const Text('Question'), + leading: Radio( + value: MessageType.Question, + groupValue: _messageType, + activeColor: Colors.red[800], + onChanged: (MessageType value) { + setState(() { + _messageType = MessageType.Question; + widget.onValueChange(_messageType); + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _messageType = MessageType.Compliment; + widget.onValueChange(_messageType); + }); + }, + child: ListTile( + title: const Text('compliment'), + leading: Radio( + value: MessageType.Compliment, + groupValue: _messageType, + activeColor: Colors.red[800], + onChanged: (MessageType value) { + setState(() { + _messageType = MessageType.Compliment; + widget.onValueChange(_messageType); + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _messageType = MessageType.Suggestion; + widget.onValueChange(_messageType); + }); + }, + child: ListTile( + title: const Text('Suggestion'), + leading: Radio( + value: MessageType.Suggestion, + groupValue: _messageType, + activeColor: Colors.red[800], + onChanged: (MessageType value) { + setState(() { + _messageType = MessageType.Suggestion; + widget.onValueChange(_messageType); + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Divider( + height: 2.5, + color: Colors.grey[500], + ), + SizedBox( + height: 5, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + 'cancel', + color: Colors.red, + ))), + ), + )), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: widget.onValueSelected, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + 'ok', + fontWeight: FontWeight.w400, + )), + ), + )), + ], + ) + ], + )), + ], + ); + } +} diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 6169fdf4..b172cffc 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/hospital_view_model.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.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:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; @@ -9,6 +10,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart' import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart'; import '../base/base_view.dart'; +import '../feedback/feedback_home_page.dart'; class HomePage extends StatefulWidget { @override @@ -18,54 +20,38 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getMedicine(), - builder: (BuildContext context, PharmacyViewModel model, Widget child) => - AppScaffold( - baseViewModel: model, - body: Column( - children: [ - InkWell( - onTap: () { - model.getMedicine(); - }, - child: Container( - child: Texts('call api'), + return AppScaffold( + body: Container( + width: double.infinity, + child: FractionallySizedBox( + widthFactor: 0.95, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + InkWell( + onTap: ()=>Navigator.push(context, FadePage(page: FeedbackHomePage())), + child: Container( + margin: EdgeInsets.only(top: 12), + width: double.infinity, + height: 180, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + border: Border.all( + color: Colors.grey[400], + width: 1.0, + ), + ), + child: Center( + child: Texts('Feedback'), + ), + ), ), - ), - Expanded( - child: _getHospitals(model.pharmacy), - ) -// BaseView( -// onModelReady: (dctorViewModel) => dctorViewModel.getHospitals(), -// builder: (BuildContext context, DoctorViewModel dctorViewModel, -// Widget child) => -// InkWell( -// onTap: () { -// dctorViewModel.getHospitals(); -// }, -// child: Container( -// width: double.infinity, -// height: 150, -// child: NetworkBaseView( -// baseViewModel: dctorViewModel, -// child: Container( -// child: Texts('The API 2'), -// ), -// ), -// ), -// ), -// ), - ], + ], + ), ), ), ); } - - Widget _getHospitals(List hospitals) => ListView.builder( - itemCount: hospitals.length, - itemBuilder: (BuildContext context, int index) => Container( - child: Texts(hospitals[index].itemDes), - ), - ); } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 9f1eb367..d5e18c74 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'home_page.dart'; class LandingPage extends StatefulWidget { @@ -38,10 +39,19 @@ class _LandingPageState extends State { if (token != null) { checkUserStatus(token); } - + requestPermissions(); //assert(token != null); }); } + void requestPermissions() async { + await [ + Permission.location, + Permission.storage, + Permission.camera, + Permission.photos, + Permission.accessMediaLocation + ].request(); + } @override Widget build(BuildContext context) { @@ -69,7 +79,8 @@ class _LandingPageState extends State { body: PageView( physics: NeverScrollableScrollPhysics(), controller: pageController, - children: [Container(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()], + children: [HomePage(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()], + ), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), ); diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index c9bce380..4cce1dc8 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -1,5 +1,4 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; -import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_doctor_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -9,7 +8,6 @@ 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:intl/intl.dart'; import 'doctor_profile_page.dart'; diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 88427f80..d61ee305 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; diff --git a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart index 643cca01..c2f70091 100644 --- a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart @@ -5,8 +5,8 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; import 'package:maps_launcher/maps_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; class PharmacyForPrescriptionsPage extends StatelessWidget { final PrescriptionReport prescriptionReport; diff --git a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart index a8b4f484..6a2bcdde 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/widgets/buttons/BottomButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart new file mode 100644 index 00000000..66ee36c4 --- /dev/null +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -0,0 +1,141 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:feather_icons_flutter/feather_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; + +class ImageOptions { + static showImageOptions(BuildContext context, Function(String) image) { + showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + builder: (BuildContext bc) { + return _BottomSheet( + children: [ + _BottomSheetItem( + title: "Select file souse", + ), + _BottomSheetItem( + title: "Gallery", + icon: FeatherIcons.image, + onTap: () async { + File _image = + await ImagePicker.pickImage(source: ImageSource.gallery); + String fileName = _image.path; + final bytes = File(fileName).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode); + } + }, + ), + _BottomSheetItem( + title: "Camera", + icon: FeatherIcons.camera, + onTap: () async { + File _image = + await ImagePicker.pickImage(source: ImageSource.camera); + String fileName = _image.path; + final bytes = File(fileName).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode); + } + }, + ), + _BottomSheetItem( + title: "Cancel", + onTap: (){}, + ) + ], + ); + }); + } +} + +class _BottomSheet extends StatelessWidget { + final List children; + + _BottomSheet({Key key, @required this.children}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.symmetric(vertical: 12.0), + decoration: BoxDecoration( + color: Theme.of(context).backgroundColor, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0))), + child: SafeArea( + top: false, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + decoration: BoxDecoration( + color: Theme.of(context).dividerColor, + borderRadius: BorderRadius.circular(3.0)), + width: 40.0, + height: 6.0, + ), + ...children + ], + ), + ), + ); + } +} + +class _BottomSheetItem extends StatelessWidget { + final Function onTap; + final IconData icon; + final String title; + final ITEM_COLOR color; + + _BottomSheetItem( + {Key key, + this.onTap, + @required this.title, + this.icon, + this.color = ITEM_COLOR.primary}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (onTap != null) { + Navigator.pop(context); + onTap(); + } + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), + child: Row( + children: [ + if (icon != null) + Icon( + icon, + color: color == ITEM_COLOR.error + ? Theme.of(context).errorColor + : Theme.of(context).primaryColor, + size: 18.0, + ), + if (icon != null) SizedBox(width: 24.0), + Texts( + title ?? "", + style: "bodyText2", + color: color == ITEM_COLOR.error + ? Theme.of(context).errorColor + : null, + ), + ], + ), + ), + ); + } +} + +enum ITEM_COLOR { primary, error } diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 5429dd39..0476c352 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -71,10 +71,12 @@ class TextFields extends StatefulWidget { this.onTap, this.fontSize = 16.0, this.fontWeight = FontWeight.w700, - this.autoValidate = false}) + this.autoValidate = false, + this.hintColor}) : super(key: key); final String hintText; + // final String initialValue; final String type; final bool autoFocus; @@ -105,6 +107,7 @@ class TextFields extends StatefulWidget { final EdgeInsets padding; final bool focus; final bool borderOnlyError; + final Color hintColor; @override _TextFieldsState createState() => _TextFieldsState(); @@ -208,6 +211,7 @@ class _TextFieldsState extends State { blurRadius: focus ? 34.0 : 12.0) ]), child: TextFormField( + keyboardAppearance: Theme.of(context).brightness, scrollPhysics: BouncingScrollPhysics(), autovalidate: widget.autoValidate, @@ -250,7 +254,8 @@ class _TextFieldsState extends State { hintStyle: TextStyle( fontSize: widget.fontSize, fontWeight: widget.fontWeight, - color: Theme.of(context).hintColor), + color: widget.hintColor ?? Theme.of(context).hintColor, + ), contentPadding: widget.padding != null ? widget.padding : EdgeInsets.symmetric(