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; bool callLog = true;
try { 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); String token = await sharedPref.getString(TOKEN);
DoctorProfileModel ? doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel? doctorProfile;
if (doctorProfile!=null) { if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile.doctorID; if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile.doctorID;
if (body['DoctorID'] == "") body['DoctorID'] = null; if (body['DoctorID'] == "") body['DoctorID'] = null;
if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID; 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 { class CheckActivationCodeForDoctorAppResponseModel {
late String? authenticationTokenID; late String? authenticationTokenID;
late List<ListDoctorsClinic>? listDoctorsClinic; late List<ListDoctorsClinic>? listDoctorsClinic;
late List<DoctorProfileModel>? listDoctorProfile; List<DoctorProfileModel>? listDoctorProfile;
late MemberInformation? memberInformation; late MemberInformation? memberInformation;
CheckActivationCodeForDoctorAppResponseModel( CheckActivationCodeForDoctorAppResponseModel(
{this.authenticationTokenID, {this.authenticationTokenID, this.listDoctorsClinic, this.memberInformation});
this.listDoctorsClinic,
this.memberInformation});
CheckActivationCodeForDoctorAppResponseModel.fromJson( CheckActivationCodeForDoctorAppResponseModel.fromJson(Map<String, dynamic> json) {
Map<String, dynamic> json) {
authenticationTokenID = json['AuthenticationTokenID']; authenticationTokenID = json['AuthenticationTokenID'];
if (json['List_DoctorsClinic'] != null) { if (json['List_DoctorsClinic'] != null) {
listDoctorsClinic = []; listDoctorsClinic = [];
@ -28,22 +25,19 @@ class CheckActivationCodeForDoctorAppResponseModel {
}); });
} }
memberInformation = json['memberInformation'] != null memberInformation =
? new MemberInformation.fromJson(json['memberInformation']) json['memberInformation'] != null ? new MemberInformation.fromJson(json['memberInformation']) : null;
: null;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['AuthenticationTokenID'] = this.authenticationTokenID; data['AuthenticationTokenID'] = this.authenticationTokenID;
if (this.listDoctorsClinic != null) { if (this.listDoctorsClinic != null) {
data['List_DoctorsClinic'] = data['List_DoctorsClinic'] = this.listDoctorsClinic!.map((v) => v.toJson()).toList();
this.listDoctorsClinic!.map((v) => v.toJson()).toList();
} }
if (this.listDoctorProfile != null) { if (this.listDoctorProfile != null) {
data['List_DoctorProfile'] = data['List_DoctorProfile'] = this.listDoctorProfile!.map((v) => v.toJson()).toList();
this.listDoctorProfile!.map((v) => v.toJson()).toList();
} }
if (this.memberInformation != null) { if (this.memberInformation != null) {
data['memberInformation'] = this.memberInformation!.toJson(); data['memberInformation'] = this.memberInformation!.toJson();
@ -60,13 +54,7 @@ class ListDoctorsClinic {
late bool? isActive; late bool? isActive;
late String? clinicName; late String? clinicName;
ListDoctorsClinic( ListDoctorsClinic({this.setupID, this.projectID, this.doctorID, this.clinicID, this.isActive, this.clinicName});
{this.setupID,
this.projectID,
this.doctorID,
this.clinicID,
this.isActive,
this.clinicName});
ListDoctorsClinic.fromJson(Map<String, dynamic> json) { ListDoctorsClinic.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID']; setupID = json['SetupID'];

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save