Merge branches 'development' and 'soap_refactor' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into soap_refactor

 Conflicts:
	lib/widgets/auth/login_form.dart
merge-requests/521/head
Elham Rababah 5 years ago
commit 7579a21b83

@ -2,11 +2,13 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/imei_details.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/doctor/user_model.dart';
class AuthService extends BaseService {
List<GetIMEIDetailsModel> _imeiDetails = [];
List<GetIMEIDetailsModel> get dashboardItemsList => _imeiDetails;
Map<String, dynamic> _loginInfo = {};
Map<String, dynamic> get loginInfo => _loginInfo;
Future selectDeviceImei(imei) async {
try {
// dynamic localRes;
@ -26,4 +28,36 @@ class AuthService extends BaseService {
super.error = error;
}
}
Future login(UserModel userInfo) async {
hasError = false;
_loginInfo = {};
try {
await baseAppClient.post(LOGIN_URL,
onSuccess: (dynamic response, int statusCode) {
_loginInfo = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: userInfo.toJson());
} catch (error) {
hasError = true;
super.error = error;
}
// await baseAppClient.post(SELECT_DEVICE_IMEI,
// onSuccess: (dynamic response, int statusCode) {
// _imeiDetails = [];
// response['List_DoctorDeviceDetails'].forEach((v) {
// _imeiDetails.add(GetIMEIDetailsModel.fromJson(v));
// });
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// }, body: {});
// } catch (error) {
// hasError = true;
// super.error = error;
// }
}
}

@ -48,8 +48,7 @@ class LabsService extends BaseService {
_requestPatientLabSpecialResult.orderNo = orderNo;
await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT,
patient: patient,
onSuccess: (dynamic response, int statusCode) {
patient: patient, onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult.clear();
response['ListPLSR'].forEach((hospital) {
patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital));
@ -60,7 +59,8 @@ class LabsService extends BaseService {
}, body: _requestPatientLabSpecialResult.toJson());
}
Future getPatientLabResult({PatientLabOrders patientLabOrder,PatiantInformtion patient}) async {
Future getPatientLabResult(
{PatientLabOrders patientLabOrder, PatiantInformtion patient}) async {
hasError = false;
Map<String, dynamic> body = Map();
body['InvoiceNo'] = patientLabOrder.invoiceNo;
@ -69,8 +69,7 @@ class LabsService extends BaseService {
body['SetupID'] = patientLabOrder.setupID;
body['ProjectID'] = patientLabOrder.projectID;
body['ClinicID'] = patientLabOrder.clinicID;
await baseAppClient.postPatient(GET_Patient_LAB_RESULT,
patient: patient,
await baseAppClient.postPatient(GET_Patient_LAB_RESULT, patient: patient,
onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult.clear();
labResultList.clear();
@ -84,19 +83,22 @@ class LabsService extends BaseService {
}
Future getPatientLabOrdersResults(
{PatientLabOrders patientLabOrder, String procedure,PatiantInformtion patient}) async {
{PatientLabOrders patientLabOrder,
String procedure,
PatiantInformtion patient}) async {
hasError = false;
Map<String, dynamic> body = Map();
body['InvoiceNo'] = patientLabOrder.invoiceNo;
body['OrderNo'] = patientLabOrder.orderNo;
if (patientLabOrder != null) {
body['InvoiceNo'] = patientLabOrder.invoiceNo;
body['OrderNo'] = patientLabOrder.orderNo;
body['SetupID'] = patientLabOrder.setupID;
body['ProjectID'] = patientLabOrder.projectID;
body['ClinicID'] = patientLabOrder.clinicID;
}
body['isDentalAllowedBackend'] = false;
body['SetupID'] = patientLabOrder.setupID;
body['ProjectID'] = patientLabOrder.projectID;
body['ClinicID'] = patientLabOrder.clinicID;
body['Procedure'] = procedure;
await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT,
patient: patient,
onSuccess: (dynamic response, int statusCode) {
patient: patient, onSuccess: (dynamic response, int statusCode) {
labOrdersResultsList.clear();
response['ListPLR'].forEach((lab) {
labOrdersResultsList.add(LabOrderResult.fromJson(lab));

@ -195,26 +195,19 @@ class AuthViewModel extends BaseViewModel {
}
}
/*
*@author: Elham Rababah
*@Date:17/5/2020
*@param: docInfo
*@return:Future<Map>
*@desc: getDocProfiles
*/
Future<dynamic> getDocProfiles(docInfo, {bool allowChangeProfile = true}) async {
Future<dynamic> getDocProfiles(docInfo,
{bool allowChangeProfile = true}) async {
try {
dynamic localRes;
await baseAppClient.post(GET_DOC_PROFILES,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
if(allowChangeProfile) {
if (allowChangeProfile) {
doctorProfile =
DoctorProfileModel.fromJson(response['DoctorProfileList'][0]);
selectedClinicName =
response['DoctorProfileList'][0]['ClinicDescription'];
response['DoctorProfileList'][0]['ClinicDescription'];
}
}, onFailure: (String error, int statusCode) {
throw error;
}, body: docInfo);

@ -4,11 +4,12 @@ import 'package:doctor_app_flutter/core/model/imei_details.dart';
import 'package:doctor_app_flutter/core/service/auth_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/models/doctor/user_model.dart';
class IMEIViewModel extends BaseViewModel {
AuthService _authService = locator<AuthService>();
List<GetIMEIDetailsModel> get imeiDetails => _authService.dashboardItemsList;
get loginInfo => _authService.loginInfo;
Future selectDeviceImei(imei) async {
setState(ViewState.Busy);
await _authService.selectDeviceImei(imei);
@ -18,4 +19,15 @@ class IMEIViewModel extends BaseViewModel {
} else
setState(ViewState.Idle);
}
Future login(UserModel userInfo) async {
setState(ViewState.Busy);
await _authService.login(userInfo);
if (_authService.hasError) {
error = _authService.error;
helpers.showErrorToast(error);
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}

@ -51,7 +51,8 @@ class _LandingPageState extends State<LandingPage> {
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: Icon(DoctorApp.drawer_icon),
icon: Image.asset('assets/images/menu.png',
height: 50, width: 50),
iconSize: 15,
color: Colors.black,
onPressed: () => Scaffold.of(context).openDrawer(),

@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/core/service/patient_service.dart';
import 'package:doctor_app_flutter/core/service/prescription_service.dart';
import 'package:doctor_app_flutter/core/service/procedure_service.dart';
import 'package:doctor_app_flutter/core/service/sickleave_service.dart';
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart';

@ -122,7 +122,7 @@ class _LoginsreenState extends State<Loginsreen> {
height: 40,
),
LoginForm(
changeLoadingStata: changeLoadingStata,
model: model,
),
],
)

@ -23,7 +23,6 @@ class PharmaciesListScreen extends StatefulWidget {
final String url;
// In the constructor, require a item id.
PharmaciesListScreen({Key key, @required this.itemID, this.url})
: super(key: key);
@ -32,18 +31,9 @@ class PharmaciesListScreen extends StatefulWidget {
}
class _PharmaciesListState extends State<PharmaciesListScreen> {
var _data;
Helpers helpers = new Helpers();
ProjectViewModel projectsProvider;
bool _isInit = true;
//bool _isOutOfStuck = false;
@override
void didChangeDependencies() {
super.didChangeDependencies();
_isInit = false;
}
@override
Widget build(BuildContext context) {
@ -145,90 +135,90 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
? Alignment.topRight
: Alignment.topLeft,
),
Expanded(
child: Container(
width: SizeConfig.screenWidth * 0.99,
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: model.pharmaciesList == null ? 0 : model
.pharmaciesList.length,
itemBuilder: (BuildContext context, int index) {
return RoundedContainer(
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(7)),
child: Image.network(
model
.pharmaciesList[index]["ProjectImageURL"],
height:
SizeConfig.imageSizeMultiplier * 15,
width:
SizeConfig.imageSizeMultiplier * 15,
fit: BoxFit.cover,
),
),
),
Expanded(
flex: 4,
child: AppText(
Container(
width: SizeConfig.screenWidth * 0.99,
margin: EdgeInsets.only(left: 10,right: 10),
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: model.pharmaciesList == null ? 0 : model
.pharmaciesList.length,
itemBuilder: (BuildContext context, int index) {
return RoundedContainer(
margin: EdgeInsets.only(top: 5),
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(7)),
child: Image.network(
model
.pharmaciesList[index]["LocationDescription"],
margin: 10,
.pharmaciesList[index]["ProjectImageURL"],
height:
SizeConfig.imageSizeMultiplier * 15,
width:
SizeConfig.imageSizeMultiplier * 15,
fit: BoxFit.cover,
),
),
Expanded(
flex: 2,
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.end,
crossAxisAlignment: WrapCrossAlignment.end,
children: <Widget>[
Padding(
padding: EdgeInsets.all(5),
child: InkWell(
child: Icon(
Icons.call,
color: Colors.red,
),
onTap: () =>
launch("tel://" +
model
.pharmaciesList[index]["PhoneNumber"]),
),
Expanded(
flex: 4,
child: AppText(
model
.pharmaciesList[index]["LocationDescription"],
margin: 10,
),
),
Expanded(
flex: 2,
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.end,
crossAxisAlignment: WrapCrossAlignment.end,
children: <Widget>[
Padding(
padding: EdgeInsets.all(5),
child: InkWell(
child: Icon(
Icons.call,
color: Colors.red,
),
onTap: () =>
launch("tel://" +
model
.pharmaciesList[index]["PhoneNumber"]),
),
Padding(
padding: EdgeInsets.all(5),
child: InkWell(
child: Icon(
Icons.pin_drop,
color: Colors.red,
),
onTap: () {
MapsLauncher.launchCoordinates(
double.parse(
model
.pharmaciesList[index]["Latitude"]),
double.parse(
model
.pharmaciesList[index]["Longitude"]),
model.pharmaciesList[index]
["LocationDescription"]);
},
),
Padding(
padding: EdgeInsets.all(5),
child: InkWell(
child: Icon(
Icons.pin_drop,
color: Colors.red,
),
onTap: () {
MapsLauncher.launchCoordinates(
double.parse(
model
.pharmaciesList[index]["Latitude"]),
double.parse(
model
.pharmaciesList[index]["Longitude"]),
model.pharmaciesList[index]
["LocationDescription"]);
},
),
],
),
),
],
),
],
),
);
}),
),
),
],
),
);
}),
)
]),
),),);

@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'lab_result_chart_and_detials.dart';
@ -17,46 +18,49 @@ class FlowChartPage extends StatelessWidget {
final PatientLabOrders patientLabOrder;
final String filterName;
final PatiantInformtion patient;
FlowChartPage({this.patientLabOrder, this.filterName, this.patient});
@override
Widget build(BuildContext context) {
return BaseView<LabsViewModel>(
onModelReady: (model) => model.getPatientLabOrdersResults(
patientLabOrder: patientLabOrder, procedure: filterName,patient: patient),
patientLabOrder: patientLabOrder,
procedure: filterName,
patient: patient),
builder: (context, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: filterName,
baseViewModel: model,
body: SingleChildScrollView(
child: model.labOrdersResultsList.isNotEmpty
? Container(
body: model.labOrdersResultsList.isNotEmpty
? SingleChildScrollView(
child: Container(
child: LabResultChartAndDetails(
name: filterName,
labResult: model.labOrdersResultsList,
),
)
: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).noDataAvailable,
fontWeight: FontWeight.normal,
color: HexColor("#B8382B"),
fontSize: SizeConfig.textMultiplier * 2.5,
),
)
],
)
: Container(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
TranslationBase.of(context).noDataAvailable,
fontWeight: FontWeight.normal,
color: HexColor("#B8382B"),
fontSize: SizeConfig.textMultiplier * 2.5,
),
)
],
),
),
),
),
),
),
);
}

@ -1,9 +1,12 @@
import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/FlowChartPage.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -13,13 +16,16 @@ class ProcedureCard extends StatelessWidget {
final EntityList entityList;
final String categoryName;
final int categoryID;
final PatiantInformtion patient;
const ProcedureCard(
{Key key,
this.onTap,
this.entityList,
this.categoryID,
this.categoryName})
this.categoryName,
this.patient,
})
: super(key: key);
@override
@ -154,6 +160,27 @@ class ProcedureCard extends StatelessWidget {
),
],
),
Container(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: FlowChartPage(
filterName: entityList.procedureName,
patient: patient,
),
),
);
},
child: Texts(
TranslationBase.of(context).showMoreBtn,
textDecoration: TextDecoration.underline,
color: Colors.blue,
),
),
),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [

@ -173,6 +173,7 @@ class ProcedureScreen extends StatelessWidget {
// helpers.showErrorToast(
// 'You Cant Update This Procedure');
},
patient: patient,
),
),
if (model.procedureList.length != 0 &&

@ -1,23 +1,19 @@
import 'package:doctor_app_flutter/lookups/hospital_lookup.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart';
import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart';
import 'package:doctor_app_flutter/widgets/shared/app_button.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:imei_plugin/imei_plugin.dart';
import 'package:provider/provider.dart';
import '../../config/shared_pref_kay.dart';
import '../../config/size_config.dart';
import '../../models/doctor/user_model.dart';
import '../../core/viewModel/auth_view_model.dart';
import '../../core/viewModel/hospital_view_model.dart';
import '../../routes.dart';
import '../../util/dr_app_shared_pref.dart';
import '../../util/dr_app_toast_msg.dart';
import '../../util/helpers.dart';
@ -28,35 +24,22 @@ DrAppToastMsg toastMsg = DrAppToastMsg();
Helpers helpers = Helpers();
class LoginForm extends StatefulWidget with DrAppToastMsg {
LoginForm({this.changeLoadingStata});
LoginForm({this.model});
final Function changeLoadingStata;
final IMEIViewModel model;
@override
_LoginFormState createState() => _LoginFormState();
}
//TODO recreate the all page and apply the MVVM here
class _LoginFormState extends State<LoginForm> {
final loginFormKey = GlobalKey<FormState>();
var projectIdController = TextEditingController();
String _platformImei = 'Unknown';
String uniqueId = "Unknown";
var projectsList = [];
bool _isInit = true;
FocusNode focusPass = FocusNode();
FocusNode focusProject = FocusNode();
HospitalViewModel projectsProv;
var userInfo = UserModel(
userID: '',
password: '',
projectID: 15,
languageID: 2,
iPAdress: "11.11.11.11",
versionID: 1.2,
channel: 9,
sessionID: "i1UJwCTSqt");
AuthViewModel authProv;
var userInfo = UserModel();
@override
void initState() {
super.initState();
@ -64,9 +47,7 @@ class _LoginFormState extends State<LoginForm> {
@override
Widget build(BuildContext context) {
authProv = Provider.of<AuthViewModel>(context);
projectsProv = Provider.of<HospitalViewModel>(context);
return Form(
key: loginFormKey,
child: Column(
@ -108,10 +89,7 @@ class _LoginFormState extends State<LoginForm> {
borderColor: Colors.white,
// keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
// decoration: buildInputDecoration(
// context,
// TranslationBase.of(context).enterId,
// 'assets/images/user_id_icon.png'),
validator: (value) {
if (value != null && value.isEmpty) {
return TranslationBase.of(context)
@ -128,8 +106,6 @@ class _LoginFormState extends State<LoginForm> {
onFieldSubmitted: (_) {
focusPass.nextFocus();
},
// onEditingComplete: () {},
// autofocus: false,
)
])),
buildSizedBox(),
@ -156,10 +132,6 @@ class _LoginFormState extends State<LoginForm> {
obscureText: true,
borderColor: Colors.white,
textInputAction: TextInputAction.next,
// decoration: buildInputDecoration(
// context,
// TranslationBase.of(context).enterPassword,
// 'assets/images/password_icon.png'),
validator: (value) {
if (value != null && value.isEmpty) {
return TranslationBase.of(context)
@ -211,12 +183,6 @@ class _LoginFormState extends State<LoginForm> {
'facilityName',
onSelectProject);
},
// showCursor: false,
// //readOnly: true,
// decoration: buildInputDecoration(
// context,
// TranslationBase.of(context).selectYourProject,
// 'assets/images/password_icon.png'),
validator: (value) {
if (value != null && value.isEmpty) {
return TranslationBase.of(context)
@ -244,18 +210,13 @@ class _LoginFormState extends State<LoginForm> {
fontSize: 14,
)),
AppTextFormField(
readOnly: true, borderColor: Colors.white,
readOnly: true,
borderColor: Colors.white,
prefix: IconButton(
icon: Icon(Icons.arrow_drop_down),
iconSize: 30,
padding: EdgeInsets.only(bottom: 30),
),
// decoration: buildInputDecoration(
// context,
// TranslationBase.of(context)
// .pleaseEnterYourProject,
// 'assets/images/password_icon.png')
)
])),
]),
@ -268,67 +229,15 @@ class _LoginFormState extends State<LoginForm> {
title: TranslationBase.of(context).login,
color: HexColor('#D02127'),
onTap: () {
login(context, authProv, widget.changeLoadingStata);
login(context, this.widget.model);
},
)),
],
)
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// RaisedButton(
// onPressed: () {
// login(context, authProv, widget.changeLoadingStata);
// },
// textColor: Colors.white,
// elevation: 0.0,
// padding: const EdgeInsets.all(0.0),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10),
// side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))),
// child: Container(
// padding: const EdgeInsets.all(10.0),
// height: 50,
// width: SizeConfig.realScreenWidth * 0.35,
// child: ),
// )
// ],
// ),
],
),
);
}
/*
*@author: Elham Rababah
*@Date:20/4/2020
*@param: context, hint, asset
*@return: InputDecoration
*@desc: decorate input feilds
*/
InputDecoration buildInputDecoration(BuildContext context, hint, asset) {
return InputDecoration(
// prefixIcon: Image.asset(asset),
hintText: hint,
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
fillColor: Colors.white,
enabledBorder: OutlineInputBorder(
//borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: HexColor('#CCCCCC')),
),
focusedBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor),
),
errorBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor),
),
focusedErrorBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor),
),
);
//));
}
SizedBox buildSizedBox() {
@ -337,103 +246,27 @@ class _LoginFormState extends State<LoginForm> {
);
}
login(context, AuthViewModel authProv, Function changeLoadingStata) {
showLoading();
login(
context,
model,
) {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
sharedPref.setInt(PROJECT_ID, userInfo.projectID);
authProv.login(userInfo).then((res) {
//changeLoadingStata(false);
hideLoading();
if (res['MessageStatus'] == 1) {
// insertDeviceImei(res, authProv);
saveObjToString(LOGGED_IN_USER, res);
model.login(userInfo).then((res) {
if (model.loginInfo['MessageStatus'] == 1) {
saveObjToString(LOGGED_IN_USER, model.loginInfo);
sharedPref.remove(LAST_LOGIN_USER);
sharedPref.setString(TOKEN, res['LogInTokenID']);
print("token" + res['LogInTokenID']);
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => VerificationMethodsScreen(
password: userInfo.password,
)));
} else {
// handel error
helpers.showErrorToast(res['ErrorEndUserMessage']);
}
}).catchError((err) {
//TODO change the logic here
if(!err.contains('eservices.hmg@drsulaimanalhabib.com') ){
hideLoading();
changeLoadingStata(false);
helpers.showErrorToast(err);}
});
} else {
changeLoadingStata(false);
}
}
insertDeviceImei(preRes, AuthViewModel authProv) {
if (_platformImei != 'Unknown') {
var imeiInfo = {
"IMEI": _platformImei,
"LogInType": 1,
"DoctorID": preRes['DoctorID'],
"DoctorName": "Test User",
"Gender": 1,
"ClinicID": 3,
"ProjectID": 15,
"DoctorTitle": "Mr.",
"ClinicName": "MED",
"ProjectName": "",
"DoctorImageURL": "UNKNOWN",
"LogInTokenID": preRes['LogInTokenID'],
"VersionID": 5.3
};
authProv.insertDeviceImei(imeiInfo).then((res) {
if (res['MessageStatus'] == 1) {
setSharedPref('platformImei', _platformImei);
saveObjToString(LOGGED_IN_USER, preRes);
Navigator.of(context).pushReplacement(MaterialPageRoute(
sharedPref.setString(TOKEN, model.loginInfo['LogInTokenID']);
Navigator.of(AppGlobal.CONTEX).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => VerificationMethodsScreen(
password: userInfo.password,
)));
// save imei on shared preferance
} else {
// handel error
helpers.showErrorToast(res['ErrorEndUserMessage']);
}
}).catchError((err) {
print(err);
helpers.showErrorToast();
});
}
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformImei;
String idunique;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
platformImei =
await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false);
idunique = await ImeiPlugin.getImei();
} catch (e) {
platformImei = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformImei = platformImei;
uniqueId = idunique;
});
}
Future<void> setSharedPref(key, value) async {
sharedPref.setString(key, value).then((success) {
print("sharedPref.setString" + success.toString());
@ -441,9 +274,7 @@ class _LoginFormState extends State<LoginForm> {
}
getProjectsList(memberID) {
//showLoading();
projectsProv.getProjectsList(memberID).then((res) {
//hideLoading();
if (res['MessageStatus'] == 1) {
projectsList = res['ProjectInfo'];
setState(() {
@ -452,16 +283,7 @@ class _LoginFormState extends State<LoginForm> {
});
} else {
print(res);
// handel error
// setState(() {
// projectsList = ListProject;
// });
}
}).catchError((err) {
setState(() {
print(err);
});
print(err);
});
}
@ -478,26 +300,11 @@ class _LoginFormState extends State<LoginForm> {
primaryFocus.unfocus();
}
showLoading() {
showDialog(
context: context,
builder: (BuildContext context) {
return Center(
child: CircularProgressIndicator(),
);
});
}
hideLoading() {
Navigator.pop(context);
}
getProjects(value) {
if (value != null && value != '') {
if (projectsList.length == 0) {
getProjectsList(value);
}
}
//_isInit = false;
}
}

@ -239,13 +239,6 @@ class _VerifyAccountState extends State<VerifyAccount> {
});
}
/*
*@author: Elham Rababah
*@Date:19/4/2020
*@param:
*@return:
*@desc: change the style for the input field
*/
TextStyle buildTextStyle() {
return TextStyle(
fontSize: SizeConfig.textMultiplier * 3,
@ -260,16 +253,8 @@ class _VerifyAccountState extends State<VerifyAccount> {
return null;
}
/*
*@author: Elham Rababah
*@Date:28/4/2020
*@param: context
*@return:InputDecoration
*@desc: buildInputDecoration
*/
InputDecoration buildInputDecoration(BuildContext context) {
return InputDecoration(
// ts/images/password_icon.png
contentPadding: EdgeInsets.only(top: 30, bottom: 30),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
@ -290,13 +275,6 @@ class _VerifyAccountState extends State<VerifyAccount> {
);
}
/*
*@author: Elham Rababah
*@Date:28/4/2020
*@param:
*@return: RichText
*@desc: buildText
*/
RichText buildText() {
String medthodName;
switch (model['OTP_SendType']) {
@ -329,13 +307,6 @@ class _VerifyAccountState extends State<VerifyAccount> {
);
}
/*
*@author: Elham Rababah
*@Date:15/4/2020
*@param: authProv
*@return:
*@desc: verify Account func call sendActivationCodeByOtpNotificationType service
*/
verifyAccount(AuthViewModel authProv, Function changeLoadingStata) async {
if (verifyAccountForm.currentState.validate()) {
changeLoadingStata(true);
@ -346,23 +317,6 @@ class _VerifyAccountState extends State<VerifyAccount> {
verifyAccountFormValue['digit3'] +
verifyAccountFormValue['digit4'];
int projectID = await sharedPref.getInt(PROJECT_ID);
Map<String, dynamic> model = {
"activationCode": activationCode,
"DoctorID": _loggedUser['DoctorID'],
"LogInTokenID": _loggedUser['LogInTokenID'],
"ProjectID": projectID,
"LanguageID": 2,
"stamp": "2020-02-26T14:48:27.221Z",
"IPAdress": "11.11.11.11",
"VersionID": 1.2,
"Channel": 9,
"TokenID": "",
"SessionID": "i1UJwCTSqt",
"IsLoginForDoctorApp": true,
"IsSilentLogIN": false
};
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp =
new CheckActivationCodeRequestModel(
zipCode: _loggedUser['ZipCode'],
@ -396,13 +350,6 @@ class _VerifyAccountState extends State<VerifyAccount> {
}
}
/*
*@author: Elham Rababah
*@Date:17/5/2020
*@param: Map<String, dynamic> profile, Function changeLoadingStata
*@return:
*@desc: loginProcessCompleted
*/
loginProcessCompleted(
Map<String, dynamic> profile, Function changeLoadingStata) {
var doctor = DoctorProfileModel.fromJson(profile);
@ -412,43 +359,10 @@ class _VerifyAccountState extends State<VerifyAccount> {
}
getDashboard(doctor, Function changeLoadingStata) {
// authProv.getDashboard(doctor).then((value) {
// print(value);
changeLoadingStata(false);
// sharedPref.setObj(DASHBOARD_DATA, value);
Navigator.of(context).pushReplacementNamed(HOME);
// });
}
Future<dynamic> _asyncSimpleDialog(
BuildContext context, List list, String txtKey,
[String text = '']) async {
return await showDialog<dynamic>(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return SimpleDialog(
title: Text(text),
children: list.map((value) {
return SimpleDialogOption(
onPressed: () {
Navigator.pop(context,
value); //here passing the index to be return on item selection
},
child: Text(value[txtKey]), //item value
);
}).toList(),
);
});
}
/*
*@author: Elham Rababah
*@Date:17/5/2020
*@param: ClinicModel clinicInfo, Function changeLoadingStata
*@return:
*@desc: getDocProfiles
*/
getDocProfiles(ClinicModel clinicInfo, Function changeLoadingStata) {
ProfileReqModel docInfo = new ProfileReqModel(
doctorID: clinicInfo.doctorID,

@ -177,24 +177,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
user.logInTypeID,
context),
fontSize: 14,
)
// Text(
// user.editedOn != null
// ? formatDate(Helpers
// .convertStringToDate(
// user.editedOn))
// : user.createdOn != null
// ? formatDate(Helpers
// .convertStringToDate(user
// .createdOn))
// : '--',
// overflow:
// TextOverflow.ellipsis,
// style: TextStyle(
// fontFamily: 'Poppins'),
// textAlign:
// TextAlign.center),
)),
))),
Flexible(
flex: 2,
child: ListTile(
@ -288,16 +271,6 @@ class _VerificationMethodsState extends State<VerificationMethods> {
Expanded(
child: getButton(5, authProv))
]),
// Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: <Widget>[
// Expanded(
// child: getButton(1, authProv)),
// Expanded(
// child: getButton(2, authProv))
// ],
// )
])
: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -366,13 +339,6 @@ class _VerificationMethodsState extends State<VerificationMethods> {
return verificationMethod == 4 || verificationMethod == 3 ? true : false;
}
/*
*@author: Elham Rababah
*@Date:15/4/2020
*@param: oTPSendType
*@return:
*@desc: send Activation Code By Otp Notification Type
*/
sendActivationCodeByOtpNotificationType(
oTPSendType, AuthViewModel authProv) async {
// TODO : build enum for verfication method
@ -860,7 +826,12 @@ class _VerificationMethodsState extends State<VerificationMethods> {
sharedPref.setObj(DOCTOR_PROFILE, profile);
projectsProvider.isLogin = true;
Navigator.pushAndRemoveUntil(context, FadePage(page: LandingPage(),), (r) => false);
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: LandingPage(),
),
(r) => false);
}
getDocProfiles(ClinicModel clinicInfo, authProv) {

Loading…
Cancel
Save