Null Safety

update_flutter_3.16.0_voipcall
Aamir Muhammad 2 years ago
parent 6d18dbbac0
commit 0db3617737

@ -130,7 +130,6 @@ class BaseAppClient {
onFailure(Utils.generateContactAdminMsg(), statusCode);
} else {
var parsed = json.decode(response.body.toString());
print("Response : $parsed");
if (parsed['ErrorType'] == 4) {
helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']);
}

@ -7,7 +7,7 @@ const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const DOCTOR_ROTATION = 'https://doctorrota.hmg.com/';
// const BASE_URL_LIVE_CARE = 'https://livecareuat.hmg.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
//const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';

@ -32,7 +32,7 @@ class RadiologyService extends BaseService {
url = GET_IN_PATIENT_ORDERS;
body['ProjectID'] = patient.projectId;
}
finalRadiologyList.clear();
hasError = false;
await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) {
finalRadiologyList = [];
@ -47,9 +47,11 @@ class RadiologyService extends BaseService {
});
} else {
isRadiologyVIDAPlus = true;
response['FinalRadiologyListAPI'].forEach((radiology) {
finalRadiologyList.add(FinalRadiology.fromJson(radiology));
});
if (response['FinalRadiologyListAPI'] != null) {
response['FinalRadiologyListAPI'].forEach((radiology) {
finalRadiologyList.add(FinalRadiology.fromJson(radiology));
});
}
}
// if (response[label] == null || response[label].length == 0) {
// label = "FinalRadiologyList";

@ -521,44 +521,44 @@ class SOAPViewModel extends BaseViewModel {
onAddMedicationStart() async {
setState(ViewState.Busy);
var services;
List services = [];
if (medicationStrengthList.length == 0) {
if (services == null) {
if (services.isEmpty) {
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)];
} else {
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength));
}
}
if (medicationFrequencyList.length == 0) {
if (services == null) {
if (services.isEmpty) {
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)];
} else {
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency));
}
}
if (medicationDoseTimeList.length == 0) {
if (services == null) {
if (services.isEmpty) {
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)];
} else {
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime));
}
}
if (medicationRouteList.length == 0) {
if (services == null) {
if (services.isEmpty) {
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)];
} else {
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute));
}
}
if (allMedicationList.length == 0) {
if (services == null) {
if (services.isEmpty) {
services = [_prescriptionService.getMedicationList()];
} else {
services.add(_prescriptionService.getMedicationList());
}
}
final results = await Future.wait(services ?? []);
final results = services;
if (_SOAPService.hasError || _prescriptionService.hasError) {
error = _SOAPService.error! + _prescriptionService.error!;

@ -54,12 +54,12 @@ class AuthenticationViewModel extends BaseViewModel {
List<VidaPlusProjectListModel> get vidaPlusProjectList => _hospitalsService.vidaPlusProjectListModel;
NewLoginInformationModel loggedUser = NewLoginInformationModel();
NewLoginInformationModel? loggedUser;
GetIMEIDetailsModel? user;
UserModel userInfo = UserModel();
final LocalAuthentication auth = LocalAuthentication();
List<BiometricType> _availableBiometrics = [];
List<BiometricType>? _availableBiometrics;
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
bool isLogin = false;
@ -100,7 +100,7 @@ class AuthenticationViewModel extends BaseViewModel {
insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
insertIMEIDetailsModel.vidaRefreshTokenID = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
insertIMEIDetailsModel.password = userInfo.password;
insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedIn["List_MemberInformation"][0]["employeeID"] : int.parse(user!.editedBy.toString());
insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser!.listMemberInformation![0].employeeID : user!.doctorID;
await _authService.insertDeviceImei(insertIMEIDetailsModel);
if (_authService.hasError) {
@ -157,11 +157,11 @@ class AuthenticationViewModel extends BaseViewModel {
int projectID = await sharedPref.getInt(PROJECT_ID);
ActivationCodeModel activationCodeModel = ActivationCodeModel(
facilityId: projectID,
memberID: loggedUser.listMemberInformation![0].memberID,
loginDoctorID: loggedUser.listMemberInformation![0].employeeID,
memberID: loggedUser!.listMemberInformation![0].memberID,
loginDoctorID: loggedUser!.listMemberInformation![0].employeeID,
otpSendType: authMethodType.getTypeIdService().toString(),
);
await sharedPref.setString(DOCTOR_ID, (loggedUser.listMemberInformation![0].employeeID).toString());
await sharedPref.setString(DOCTOR_ID, (loggedUser!.listMemberInformation![0].employeeID).toString());
await _authService.sendActivationCodeForDoctorApp(activationCodeModel);
if (_authService.hasError) {
error = _authService.error;
@ -177,8 +177,8 @@ class AuthenticationViewModel extends BaseViewModel {
setState(ViewState.BusyLocal);
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel(
zipCode: loggedUser != null ? loggedUser.zipCode : user!.zipCode,
mobileNumber: loggedUser != null ? loggedUser.mobileNumber : user!.mobile,
zipCode: loggedUser != null ? loggedUser!.zipCode : user!.zipCode,
mobileNumber: loggedUser != null ? loggedUser!.mobileNumber : user!.mobile,
projectID: await sharedPref.getInt(PROJECT_ID) != null ? await sharedPref.getInt(PROJECT_ID) : user!.projectID,
logInTokenID: await sharedPref.getString(TOKEN),
activationCode: activationCode ?? '0000',
@ -187,7 +187,7 @@ class AuthenticationViewModel extends BaseViewModel {
facilityId: userInfo.projectID != null ? userInfo.projectID.toString() : user!.projectID.toString(),
oTPSendType: await sharedPref.getInt(OTP_TYPE),
iMEI: localToken,
loginDoctorID: loggedUser != null ? loggedUser.listMemberInformation![0].employeeID : int.parse(user!.editedBy.toString()),
loginDoctorID: loggedUser != null ? loggedUser!.listMemberInformation![0].employeeID : int.parse(user!.editedBy.toString()),
///loggedUser.listMemberInformation[0].employeeID,
// loggedUser.listMemberInformation[0].employeeID,
@ -305,8 +305,8 @@ class AuthenticationViewModel extends BaseViewModel {
bool isAvailable = false;
await _getAvailableBiometrics();
if (_availableBiometrics != null) {
for (var i = 0; i < _availableBiometrics.length; i++) {
if (biometricType == _availableBiometrics[i]) isAvailable = true;
for (var i = 0; i < _availableBiometrics!.length; i++) {
if (biometricType == _availableBiometrics![i]) isAvailable = true;
}
}
return isAvailable;

@ -93,7 +93,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
letterSpacing: -0.72,
),
AppText(
Utils.convertToTitleCase(authenticationViewModel.user!.doctorName!),
Utils.convertToTitleCase(authenticationViewModel.user!.doctorName),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 6,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.bold,
@ -422,7 +422,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
new SMSOTP(
context,
type,
authenticationViewModel.loggedUser != null ? authenticationViewModel.loggedUser.mobileNumber : authenticationViewModel.user!.mobile,
authenticationViewModel.loggedUser != null ? authenticationViewModel.loggedUser!.mobileNumber : authenticationViewModel.user!.mobile,
(value) {
showDialog(
context: context,

@ -113,7 +113,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
height: 160,
decoration: BoxDecoration(
//Colors.red[900] Color(0xff404545)
color: model.radiologyList[index].isLiveCareAppodynamicment!
color: model.radiologyList[index].isLiveCareAppodynamicment ?? false
? Colors.red[900]
: !model.radiologyList[index].isInOutPatient!
? Colors.black

@ -49,100 +49,80 @@ class _ReferredPatientScreenState extends State<ReferredPatientScreen> {
},
),
),
if (model.listMyReferredPatientModel == null ||
model.listMyReferredPatientModel.length == 0) Center(
child: ErrorMessage(
error: TranslationBase.of(context).referralEmptyMsg,
)) else Expanded(
child: SingleChildScrollView(
// DoctorApplication.svc/REST/GtMyReferredPatient
child: Container(
child: Column(
children: [
ListView.builder(
itemCount:
model.listMyReferredPatientModel.length,
scrollDirection: Axis.vertical,
physics: ScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferredPatientDetailScreen(
model.getReferredPatientItem(index),
this.patientType),
),
);
},
child: PatientReferralItemWidget(
referralStatus: model
.getReferredPatientItem(index)
.referralStatusDesc!,
referralStatusCode: model
.getReferredPatientItem(index)
.referralStatus!,
patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
patientGender: model
.getReferredPatientItem(index)
.gender!,
referredDate: model.state == ViewState.BusyLocal ?"":
AppDateUtils.getDayMonthYearDateFormatted(
patientType == PatientType.IN_PATIENT?
AppDateUtils.getDateTimeFromServerFormat(
model.getReferredPatientItem(index).referralDate!,
):AppDateUtils.getDateTimeFromString(
model.getReferredPatientItem(index).referralDate!,
),
isMonthShort: true
),
referredTime:model.state == ViewState.BusyLocal ?"":AppDateUtils.getHour(
patientType == PatientType.IN_PATIENT?
AppDateUtils.getDateTimeFromServerFormat(
model.getReferredPatientItem(index).referralDate!,
):AppDateUtils.getDateTimeFromString(
model.getReferredPatientItem(index).referralDate!,
),
// isMonthShort: true
),
patientID:
"${model.getReferredPatientItem(index).patientID}",
isSameBranch: model
.getReferredPatientItem(index)
.isReferralDoctorSameBranch,
isReferral: false,
remark: model
.getReferredPatientItem(index)
.referringDoctorRemarks!,
nationality: model
.getReferredPatientItem(index)
.nationalityName!,
nationalityFlag: model
.getReferredPatientItem(index)
.nationalityFlagURL!,
doctorAvatar: model
.getReferredPatientItem(index)
.doctorImageURL!,
referralDoctorName: "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}",
clinicDescription: model
.getReferredPatientItem(index)
.referralClinicDescription!,
infoIcon: Icon(FontAwesomeIcons.arrowRight,
size: 25, color: Colors.black),
if (model.listMyReferredPatientModel == null || model.listMyReferredPatientModel.length == 0)
Center(
child: ErrorMessage(
error: TranslationBase.of(context).referralEmptyMsg,
))
else
Expanded(
child: SingleChildScrollView(
// DoctorApplication.svc/REST/GtMyReferredPatient
child: Container(
child: Column(
children: [
ListView.builder(
itemCount: model.listMyReferredPatientModel.length,
scrollDirection: Axis.vertical,
physics: ScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferredPatientDetailScreen(model.getReferredPatientItem(index), this.patientType),
),
);
},
),
],
child: PatientReferralItemWidget(
referralStatus: model.getReferredPatientItem(index).referralStatusDesc!,
referralStatusCode: model.getReferredPatientItem(index).referralStatus!,
patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
patientGender: model.getReferredPatientItem(index).gender!,
referredDate: model.state == ViewState.BusyLocal
? ""
: AppDateUtils.getDayMonthYearDateFormatted(
patientType == PatientType.IN_PATIENT
? AppDateUtils.getDateTimeFromServerFormat(
model.getReferredPatientItem(index).referralDate!,
)
: AppDateUtils.getDateTimeFromString(
model.getReferredPatientItem(index).referralDate!,
),
isMonthShort: true),
referredTime: model.state == ViewState.BusyLocal
? ""
: AppDateUtils.getHour(
patientType == PatientType.IN_PATIENT
? AppDateUtils.getDateTimeFromServerFormat(
model.getReferredPatientItem(index).referralDate!,
)
: AppDateUtils.getDateTimeFromString(
model.getReferredPatientItem(index).referralDate!,
),
// isMonthShort: true
),
patientID: "${model.getReferredPatientItem(index).patientID}",
isSameBranch: model.getReferredPatientItem(index).isReferralDoctorSameBranch,
isReferral: false,
remark: model.getReferredPatientItem(index).referringDoctorRemarks!,
nationality: model.getReferredPatientItem(index).nationalityName ?? "",
nationalityFlag: model.getReferredPatientItem(index).nationalityFlagURL!,
doctorAvatar: model.getReferredPatientItem(index).doctorImageURL!,
referralDoctorName: "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}",
clinicDescription: model.getReferredPatientItem(index).referralClinicDescription!,
infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black),
),
);
},
),
),
],
),
),
),
),
],
),
),
@ -156,8 +136,7 @@ class PatientTypeRadioWidget extends StatefulWidget {
PatientTypeRadioWidget(this.radioOnChange);
@override
_PatientTypeRadioWidgetState createState() =>
_PatientTypeRadioWidgetState(this.radioOnChange);
_PatientTypeRadioWidgetState createState() => _PatientTypeRadioWidgetState(this.radioOnChange);
}
class _PatientTypeRadioWidgetState extends State<PatientTypeRadioWidget> {

@ -1,7 +1,7 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
@ -11,7 +11,7 @@ import 'package:provider/provider.dart';
class ExaminationItemCard extends StatelessWidget {
final MySelectedExamination examination;
final Function removeExamination;
final Function() removeExamination;
ExaminationItemCard(this.examination, this.removeExamination);
@ -32,8 +32,7 @@ class ExaminationItemCard extends StatelessWidget {
child: Container(
child: AppText(
projectViewModel.isArabic
? examination.selectedExamination!.nameAr != null &&
examination.selectedExamination!.nameAr != ""
? examination.selectedExamination!.nameAr != null && examination.selectedExamination!.nameAr != ""
? examination.selectedExamination!.nameAr!
: examination.selectedExamination!.nameEn!
: examination.selectedExamination!.nameEn!,
@ -65,9 +64,7 @@ class ExaminationItemCard extends StatelessWidget {
),
if (!examination.notExamined)
RemoveButton(
label: examination.isLocal
? TranslationBase.of(context).remove
: TranslationBase.of(context).notExamined,
label: examination.isLocal ? TranslationBase.of(context).remove : TranslationBase.of(context).notExamined,
onTap: removeExamination,
),
],
@ -75,8 +72,7 @@ class ExaminationItemCard extends StatelessWidget {
SizedBox(
height: 4,
),
if (examination.remark!.isNotEmpty)
RemarkText(remark: examination.remark!),
if (examination.remark!.isNotEmpty) RemarkText(remark: examination.remark!),
],
),
);

@ -4,15 +4,15 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
class SOAPOpenItems extends StatelessWidget {
final Function? onTap;
final Function() onTap;
final String label;
const SOAPOpenItems({Key? key, this.onTap, this.label = ''}) : super(key: key);
const SOAPOpenItems({Key? key, required this.onTap, this.label = ''}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap!(),
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8.0),
margin: EdgeInsets.symmetric(vertical: 8),

@ -58,7 +58,7 @@ class ExpandableSOAPWidget extends StatelessWidget {
),
),
InkWell(
onTap: onTap!(),
onTap: onTap,
child: Icon(isExpanded ? EvaIcons.arrowIosUpwardOutline : EvaIcons.arrowIosDownwardOutline),
)
],

@ -6,10 +6,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hexcolor/hexcolor.dart';
class RemoveButton extends StatelessWidget {
final Function? onTap;
final Function() onTap;
final String label;
const RemoveButton({Key? key, this.onTap, this.label = ''}) : super(key: key);
const RemoveButton({Key? key, required this.onTap, this.label = ''}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -32,7 +32,7 @@ class RemoveButton extends StatelessWidget {
),
],
),
onTap: onTap!(),
onTap: onTap,
);
}
}

@ -3,6 +3,7 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
@ -23,7 +24,7 @@ import '../../shared_soap_widgets/bottom_sheet_title.dart';
// ignore: must_be_immutable
class AddMedication extends StatefulWidget {
final Function addMedicationFun;
final Function(MySelectedAllergy mySelectedAllergy) addMedicationFun;
TextEditingController medicationController;
AddMedication({Key? key, required this.addMedicationFun, required this.medicationController}) : super(key: key);
@ -42,7 +43,7 @@ class _AddMedicationState extends State<AddMedication> {
TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
GetMedicationResponseModel _selectedMedication = GetMedicationResponseModel();
GetMedicationResponseModel? _selectedMedication;
GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>> key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
bool isFormSubmitted = false;
@ -52,8 +53,8 @@ class _AddMedicationState extends State<AddMedication> {
ProjectViewModel projectViewModel = Provider.of(context);
return FractionallySizedBox(
child: BaseView<SOAPViewModel>(
onModelReady: (model) async {
model.onAddMedicationStart();
onModelReady: (model) {
if (!mounted) model.onAddMedicationStart();
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
@ -110,7 +111,7 @@ class _AddMedicationState extends State<AddMedication> {
: AppTextFieldCustom(
height: Utils.getTextFieldHeight(),
hintText: _selectedMedication != null
? _selectedMedication.description! + (' (${_selectedMedication.genericName} )')
? _selectedMedication!.description! + (' (${_selectedMedication!.genericName} )')
: TranslationBase.of(context).searchMedicineNameHere,
minLines: 1,
maxLines: 1,
@ -137,7 +138,7 @@ class _AddMedicationState extends State<AddMedication> {
Container(
width: MediaQuery.of(context).size.width * 0.7,
child: AppText(
_selectedMedication.description! + (' (${_selectedMedication.genericName} )'),
_selectedMedication!.description! + (' (${_selectedMedication!.genericName} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
@ -335,7 +336,7 @@ class _AddMedicationState extends State<AddMedication> {
_selectedMedicationRoute != null &&
_selectedMedicationFrequency != null) {
widget.medicationController.text = widget.medicationController.text +
'${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
'${_selectedMedication!.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
Navigator.of(context).pop();
}
},

@ -160,11 +160,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> implements
ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).chiefComplaints,
onTap: () {
if (mounted) {
setState(() {
isChiefExpand = !isChiefExpand;
});
}
setState(() {
isChiefExpand = !isChiefExpand;
});
},
child: UpdateChiefComplaints(
formKey: formKey,

@ -153,8 +153,6 @@ class _AddProcedurePageState extends State<AddProcedurePage> {
},
addSelectedHistories: () {},
selectedType: (val) {
print("------------");
print(val);
selectedType = val;
},
isEntityListSelected: (master) => widget.model.isEntityListSelected(master, entityList),

@ -24,8 +24,7 @@ class AddRescheduleLeaveScreen extends StatelessWidget {
Widget build(BuildContext context) {
projectsProvider = Provider.of(context);
return BaseView<SickLeaveViewModel>(
onModelReady: (model) =>
{model.getRescheduleLeave(), model.getCoveringDoctors()},
onModelReady: (model) => {model.getRescheduleLeave(), model.getCoveringDoctors()},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
@ -50,8 +49,7 @@ class AddRescheduleLeaveScreen extends StatelessWidget {
),
),
Column(
children: model.getReschduleLeave
.map<Widget>((GetRescheduleLeavesResponse item) {
children: model.getReschduleLeave.map<Widget>((GetRescheduleLeavesResponse item) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: RoundedContainer(
@ -79,77 +77,53 @@ class AddRescheduleLeaveScreen extends StatelessWidget {
child: Wrap(
children: <Widget>[
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Container(
padding: EdgeInsets.all(3),
margin:
EdgeInsets.only(top: 10),
child: AppText(
item.statusDescription!,
fontWeight: FontWeight.bold,
color: item.status == 10
? Colors.red[800]!
: item.status == 2
? HexColor(
'#CC9B14')
: item.status == 9
? AppGlobal
.appGreenColor
: Colors.red,
fontSize: 14,
),
),
Padding(
padding: EdgeInsets.only(
top: 10),
child: AppText(
AppDateUtils
.convertStringToDateFormat(
item.createdOn!,
'yyyy-MM-dd HH:mm'),
fontWeight:
FontWeight.bold,
))
]),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Container(
padding: EdgeInsets.all(3),
margin: EdgeInsets.only(top: 10),
child: AppText(
item.statusDescription!,
fontWeight: FontWeight.bold,
color: item.status == 10
? Colors.red[800]!
: item.status == 2
? HexColor('#CC9B14')
: item.status == 9
? AppGlobal.appGreenColor
: Colors.red,
fontSize: 14,
),
),
Padding(
padding: EdgeInsets.only(top: 10),
child: AppText(
AppDateUtils.convertStringToDateFormat(item.createdOn!, 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
))
]),
SizedBox(
height: 5,
),
Container(
child: AppText(
item.requisitionType == 1
? TranslationBase.of(context)
.offTime
? TranslationBase.of(context).offTime
: item.requisitionType == 2
? TranslationBase.of(
context)
.holiday
? TranslationBase.of(context).holiday
: item.requisitionType == 3
? TranslationBase.of(
context)
.changeOfSchedule
: TranslationBase.of(
context)
.newSchedule,
? TranslationBase.of(context).changeOfSchedule
: TranslationBase.of(context).newSchedule,
fontWeight: FontWeight.bold,
)),
SizedBox(
height: 5,
),
Row(children: [
AppText(TranslationBase.of(context)
.startDate),
AppText(TranslationBase.of(context).startDate),
AppText(
AppDateUtils
.convertStringToDateFormat(
item.dateTimeFrom!,
'yyyy-MM-dd HH:mm'),
AppDateUtils.convertStringToDateFormat(item.dateTimeFrom!, 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
)
@ -165,14 +139,9 @@ class AddRescheduleLeaveScreen extends StatelessWidget {
),
Row(
children: [
AppText(TranslationBase.of(context).endDate),
AppText(
TranslationBase.of(context)
.endDate),
AppText(
AppDateUtils
.convertStringToDateFormat(
item.dateTimeTo!,
'yyyy-MM-dd HH:mm'),
AppDateUtils.convertStringToDateFormat(item.dateTimeTo!, 'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
)
],
@ -184,42 +153,24 @@ class AddRescheduleLeaveScreen extends StatelessWidget {
model.coveringDoctors.length > 0
? Row(children: [
AppText(
TranslationBase.of(context)
.coveringDoctor,
TranslationBase.of(context).coveringDoctor,
),
AppText(
getDoctor(
model.coveringDoctors,
item.coveringDoctorId),
getDoctor(model.coveringDoctors, item.coveringDoctorId),
fontWeight: FontWeight.bold,
)
])
: SizedBox(),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Padding(
padding: EdgeInsets.only(
bottom: 5),
child: AppText(getReasons(
model.allReasons,
item.reasonId))),
(item.status == 2)
? IconButton(
icon: Image.asset(
'assets/images/edit.png'),
// color: AppGlobal.appGreenColor, //Colors.black,
onPressed: () => {
openLeave(
context, true,
extendedData:
item)
},
)
: SizedBox(),
]),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Padding(padding: EdgeInsets.only(bottom: 5), child: AppText(getReasons(model.allReasons, item.reasonId))),
(item.status == 2)
? IconButton(
icon: Image.asset('assets/images/edit.png'),
// color: AppGlobal.appGreenColor, //Colors.black,
onPressed: () => {openLeave(context, true, extendedData: item)},
)
: SizedBox(),
]),
],
),
SizedBox(
@ -241,7 +192,6 @@ class AddRescheduleLeaveScreen extends StatelessWidget {
}
openLeave(BuildContext context, isExtend, {extendedData}) {
Navigator.push(
context,
FadePage(

@ -41,7 +41,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
late ProjectViewModel projectsProvider;
late SickLeaveViewModel sickLeaveViewModel;
Map profile = {};
var offTime = '1';
var offTime;
var date;
var doctorID;
var reason;
@ -203,7 +203,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
children: [
AppTextFormField(
hintText: TranslationBase.of(context).fromDate,
borderColor: Colors.white,
borderColor: Colors.transparent,
prefix: IconButton(
icon: Icon(Icons.calendar_today),
onPressed: () {},
@ -229,19 +229,19 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
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,
// ),
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,
),
],
),
),
@ -292,7 +292,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
children: [
AppTextFormField(
hintText: TranslationBase.of(context).fromDate,
borderColor: Colors.white,
borderColor: Colors.transparent,
prefix: IconButton(
icon: Icon(Icons.calendar_today),
onPressed: () {},
@ -321,7 +321,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
AppTextFormField(
hintText: TranslationBase.of(context).toDate,
readOnly: true,
borderColor: Colors.white,
borderColor: Colors.transparent,
prefix: IconButton(
icon: Icon(Icons.calendar_today),
onPressed: () {},
@ -556,8 +556,17 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
var fromDates = fromDate;
var toDates = toDate;
if (offTime == '1') {
fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) + 'T' + fromTime! + ':' + DateTime.now().second.toString()));
toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + 'T' + toTime! + ':' + DateTime.now().second.toString()));
print("-----");
print(DateTime.now());
print("-----");
print(dateFormat.format(fromDates) + ' ' + fromTime! + ':' + DateTime.now().second.toString() + '.' + DateTime.now().microsecond.toString());
print("-0-0-0-0");
fromDate = df.format(
DateTime.parse(
dateFormat.format(fromDates) + ' ' + fromTime! + ':' + DateTime.now().second.toString(),
),
);
toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + ' ' + toTime! + ':' + DateTime.now().second.toString()));
} else {
fromDate = df.format(fromDates);
toDate = df.format(toDates);

@ -105,7 +105,7 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
: null,
padding: EdgeInsets.only(top: 4.0, bottom: 0.0, left: 8.0, right: 8.0),
child: InkWell(
onTap: widget.onClick ?? null,
onTap: widget.onClick,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [

Loading…
Cancel
Save