flutter 2 migration

flutter_vervion_2
hussam al-habibeh 5 years ago
parent ea2a635925
commit bb20b4d582

@ -31,10 +31,11 @@ class BaseAppClient {
bool callLog = true;
try {
Map<String, dynamic> profile = await sharedPref.getObj(DOCTOR_PROFILE);
Map<String, dynamic>? profile = await sharedPref.getObj(DOCTOR_PROFILE);
String token = await sharedPref.getString(TOKEN);
DoctorProfileModel ? doctorProfile = DoctorProfileModel.fromJson(profile);
if (doctorProfile!=null) {
DoctorProfileModel? doctorProfile;
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile.doctorID;
if (body['DoctorID'] == "") body['DoctorID'] = null;
if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID;

@ -3,16 +3,13 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
class CheckActivationCodeForDoctorAppResponseModel {
late String? authenticationTokenID;
late List<ListDoctorsClinic>? listDoctorsClinic;
late List<DoctorProfileModel>? listDoctorProfile;
List<DoctorProfileModel>? listDoctorProfile;
late MemberInformation? memberInformation;
CheckActivationCodeForDoctorAppResponseModel(
{this.authenticationTokenID,
this.listDoctorsClinic,
this.memberInformation});
{this.authenticationTokenID, this.listDoctorsClinic, this.memberInformation});
CheckActivationCodeForDoctorAppResponseModel.fromJson(
Map<String, dynamic> json) {
CheckActivationCodeForDoctorAppResponseModel.fromJson(Map<String, dynamic> json) {
authenticationTokenID = json['AuthenticationTokenID'];
if (json['List_DoctorsClinic'] != null) {
listDoctorsClinic = [];
@ -28,22 +25,19 @@ class CheckActivationCodeForDoctorAppResponseModel {
});
}
memberInformation = json['memberInformation'] != null
? new MemberInformation.fromJson(json['memberInformation'])
: null;
memberInformation =
json['memberInformation'] != null ? new MemberInformation.fromJson(json['memberInformation']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['AuthenticationTokenID'] = this.authenticationTokenID;
if (this.listDoctorsClinic != null) {
data['List_DoctorsClinic'] =
this.listDoctorsClinic!.map((v) => v.toJson()).toList();
data['List_DoctorsClinic'] = this.listDoctorsClinic!.map((v) => v.toJson()).toList();
}
if (this.listDoctorProfile != null) {
data['List_DoctorProfile'] =
this.listDoctorProfile!.map((v) => v.toJson()).toList();
data['List_DoctorProfile'] = this.listDoctorProfile!.map((v) => v.toJson()).toList();
}
if (this.memberInformation != null) {
data['memberInformation'] = this.memberInformation!.toJson();
@ -60,13 +54,7 @@ class ListDoctorsClinic {
late bool? isActive;
late String? clinicName;
ListDoctorsClinic(
{this.setupID,
this.projectID,
this.doctorID,
this.clinicID,
this.isActive,
this.clinicName});
ListDoctorsClinic({this.setupID, this.projectID, this.doctorID, this.clinicID, this.isActive, this.clinicName});
ListDoctorsClinic.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];

@ -56,8 +56,8 @@ class AuthenticationViewModel extends BaseViewModel {
CheckActivationCodeForDoctorAppResponseModel get checkActivationCodeForDoctorAppRes =>
_authService.checkActivationCodeForDoctorAppRes;
late NewLoginInformationModel loggedUser;
late GetIMEIDetailsModel? user;
NewLoginInformationModel? loggedUser;
GetIMEIDetailsModel? user;
UserModel userInfo = UserModel();
final LocalAuthentication auth = LocalAuthentication();
@ -165,9 +165,9 @@ class AuthenticationViewModel extends BaseViewModel {
int projectID = await sharedPref.getInt(PROJECT_ID);
ActivationCodeModel activationCodeModel = ActivationCodeModel(
facilityId: projectID,
memberID: loggedUser.listMemberInformation![0].memberID,
zipCode: loggedUser.zipCode,
mobileNumber: loggedUser.mobileNumber,
memberID: loggedUser!.listMemberInformation![0].memberID,
zipCode: loggedUser!.zipCode,
mobileNumber: loggedUser!.mobileNumber,
otpSendType: authMethodType.getTypeIdService().toString(),
password: password);
await _authService.sendActivationCodeForDoctorApp(activationCodeModel);
@ -182,8 +182,8 @@ class AuthenticationViewModel extends BaseViewModel {
Future checkActivationCodeForDoctorApp({required String activationCode}) async {
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(LOGIN_TOKEN_ID),
activationCode: activationCode ?? '0000',

@ -47,7 +47,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
late ProjectViewModel projectsProvider;
bool isMoreOption = false;
bool onlySMSBox = false;
late AuthMethodTypes fingerPrintBefore;
AuthMethodTypes? fingerPrintBefore;
late AuthMethodTypes selectedOption;
late AuthenticationViewModel authenticationViewModel;
@ -410,7 +410,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
if (authMethodType == AuthMethodTypes.Fingerprint || authMethodType == AuthMethodTypes.FaceID) {
fingerPrintBefore = authMethodType;
}
this.selectedOption = fingerPrintBefore != null ? fingerPrintBefore : authMethodType;
this.selectedOption = (fingerPrintBefore != null ? fingerPrintBefore : authMethodType)!;
switch (authMethodType) {
case AuthMethodTypes.SMS:
@ -444,7 +444,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
context,
type,
authenticationViewModel.loggedUser != null
? authenticationViewModel.loggedUser.mobileNumber
? authenticationViewModel.loggedUser!.mobileNumber
: authenticationViewModel.user!.mobile,
(value) {
showDialog(

@ -15,14 +15,14 @@ class HomePageCard extends StatelessWidget {
final bool hasBorder;
final String? imageName;
final Widget child;
final Function onTap;
final GestureTapCallback onTap;
final Color color;
final double opacity;
final EdgeInsets margin;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap(),
onTap: onTap,
child: Container(
width: 120,
height: MediaQuery.of(context).orientation == Orientation.portrait ? 100 : 200,

@ -9,7 +9,7 @@ class HomePatientCard extends StatelessWidget {
final Color backgroundIconColor;
final String text;
final Color textColor;
final Function onTap;
final GestureTapCallback onTap;
HomePatientCard({
required this.backgroundColor,

@ -68,7 +68,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
List<String> _times = [];
int _activeLocation = 1;
late String patientType;
String? patientType;
late String patientTypeTitle;
var selectedFilter = 1;
late String arrivalType;
@ -252,8 +252,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
padding: EdgeInsets.all(8.0),
child: PatientCard(
patientInfo: model.filterData[index],
patientType: patientType,
arrivalType: arrivalType,
patientType: "1",
arrivalType: "1",
isFromSearch: widget.isSearchAndOut,
isInpatient: widget.isInpatient,
onTap: () {

@ -121,9 +121,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
bool visbiltySearch = true;
final myController = TextEditingController();
late DateTime selectedDate;
late int strengthChar;
late GetMedicationResponseModel _selectedMedication;
DateTime? selectedDate;
int? strengthChar;
GetMedicationResponseModel? _selectedMedication;
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController();
@ -358,7 +358,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
visbiltyPrescriptionForm = true;
visbiltySearch = false;
_selectedMedication = model.allMedicationList[index];
uom = _selectedMedication.uom;
uom = _selectedMedication!.uom;
},
);
},
@ -417,7 +417,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setState(() {
strengthChar = value.length;
});
if (strengthChar >= 5) {
if (strengthChar! >= 5) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).only5DigitsAllowedForStrength,
);
@ -483,7 +483,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId!,
itemCode: _selectedMedication!.itemId!,
strength: double.parse(strengthController.text));
return;
@ -577,7 +577,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
model.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId!,
itemCode: _selectedMedication!.itemId!,
strength: double.parse(strengthController.text),
);
box = model.boxQuintity;
@ -661,7 +661,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
units != null &&
selectedDate != null &&
strengthController.text != "") {
if (_selectedMedication.isNarcotic == true) {
if (_selectedMedication!.isNarcotic == true) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
.narcoticMedicineCanOnlyBePrescribedFromVida);
Navigator.pop(context);
@ -922,7 +922,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
route: model.itemMedicineListRoute.length == 1
? model.itemMedicineListRoute[0]['parameterCode'].toString()
: route['parameterCode'].toString(),
drugId: _selectedMedication.itemId.toString(),
drugId: _selectedMedication!.itemId.toString(),
strength: strengthController.text,
indication: indicationController.text,
instruction: instructionController.text,
@ -958,10 +958,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}
});
}
if (_selectedMedication.mediSpanGPICode != null) {
if (_selectedMedication!.mediSpanGPICode != null) {
prescriptionDetails.add({
'DrugId': _selectedMedication.mediSpanGPICode,
'DrugName': _selectedMedication.description,
'DrugId': _selectedMedication!.mediSpanGPICode,
'DrugName': _selectedMedication!.description,
'Dose': strengthController.text,
'DoseType': model.itemMedicineListUnit.length == 1
? model.itemMedicineListUnit[0]['parameterCode'].toString()

@ -15,10 +15,10 @@ class ExpansionProcedure extends StatefulWidget {
final ProcedureViewModel model;
final Function(ProcedureTempleteDetailsModel) removeFavProcedure;
final Function(ProcedureTempleteDetailsModel) addFavProcedure;
final Function(ProcedureTempleteDetailsModel) selectProcedures;
final Function(ProcedureTempleteDetailsModel)? selectProcedures;
final bool Function(ProcedureTempleteModel) isEntityListSelected;
final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected;
final bool Function(ProcedureTempleteModel)? isEntityListSelected;
final bool Function(ProcedureTempleteDetailsModel)? isEntityFavListSelected;
final bool isProcedure;
final ProcedureTempleteDetailsModel groupProcedures;
@ -28,9 +28,9 @@ class ExpansionProcedure extends StatefulWidget {
required this.model,
required this.removeFavProcedure,
required this.addFavProcedure,
required this.selectProcedures,
required this.isEntityListSelected,
required this.isEntityFavListSelected,
this.selectProcedures,
this.isEntityListSelected,
this.isEntityFavListSelected,
this.isProcedure = true,
required this.groupProcedures})
: super(key: key);
@ -118,14 +118,14 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
onTap: () {
if (widget.isProcedure) {
setState(() {
if (widget.isEntityFavListSelected(itemProcedure)) {
if (widget.isEntityFavListSelected!(itemProcedure)) {
widget.removeFavProcedure(itemProcedure);
} else {
widget.addFavProcedure(itemProcedure);
}
});
} else {
widget.selectProcedures(itemProcedure);
widget.selectProcedures!(itemProcedure);
}
},
child: Container(
@ -140,11 +140,11 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
padding: const EdgeInsets.symmetric(horizontal: 11),
child: widget.isProcedure
? Checkbox(
value: widget.isEntityFavListSelected(itemProcedure),
value: widget.isEntityFavListSelected!(itemProcedure),
activeColor: Color(0xffD02127),
onChanged: (bool? newValue) {
setState(() {
if (widget.isEntityFavListSelected(itemProcedure)) {
if (widget.isEntityFavListSelected!(itemProcedure)) {
widget.removeFavProcedure(itemProcedure);
} else {
widget.addFavProcedure(itemProcedure);
@ -156,7 +156,7 @@ class _ExpansionProcedureState extends State<ExpansionProcedure> {
groupValue: widget.groupProcedures,
activeColor: Color(0xffD02127),
onChanged: (ProcedureTempleteDetailsModel? newValue) {
widget.selectProcedures(newValue!);
widget.selectProcedures!(newValue!);
})),
Expanded(
child: Padding(

@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ProcedureCard extends StatelessWidget {
final Function onTap;
final GestureTapCallback onTap;
final EntityList entityList;
final String? categoryName;
final int categoryID;
@ -248,7 +248,7 @@ class ProcedureCard extends StatelessWidget {
doctorID == entityList.doctorID)
InkWell(
child: Icon(DoctorApp.edit),
onTap: onTap(),
onTap: onTap,
)
],
),

@ -11,7 +11,7 @@ import 'package:flutter/material.dart';
class PatientCard extends StatelessWidget {
final PatiantInformtion patientInfo;
final Function onTap;
final GestureTapCallback onTap;
final String patientType;
final String arrivalType;
final bool isInpatient;
@ -451,7 +451,7 @@ class PatientCard extends StatelessWidget {
: SizedBox()
],
),
onTap: onTap(),
onTap: onTap,
)),
));
}

Loading…
Cancel
Save