Conflicts:
	lib/client/base_app_client.dart
	lib/screens/dashboard_screen.dart
merge-requests/113/head
Mohammad ALjammal 6 years ago
commit ed857d8d54

@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:http_interceptor/http_methods.dart'; import 'package:http_interceptor/http_methods.dart';
import 'package:http_interceptor/models/request_data.dart'; import 'package:http_interceptor/models/request_data.dart';
@ -48,7 +49,7 @@ class BaseAppClient {
// if (!body.containsKey('ClinicID')) // if (!body.containsKey('ClinicID'))
body['ClinicID'] = doctorProfile?.clinicID; body['ClinicID'] = doctorProfile?.clinicID;
} }
body['TokenID'] = token?? ''; body['TokenID'] = token ?? '';
body['LanguageID'] = LANGUAGE_ID; body['LanguageID'] = LANGUAGE_ID;
body['stamp'] = STAMP; body['stamp'] = STAMP;
body['IPAdress'] = IP_ADDRESS; body['IPAdress'] = IP_ADDRESS;

@ -16,7 +16,6 @@ import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart';
import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart'; import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart';
import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.dart'; import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.dart';
import 'package:doctor_app_flutter/models/prescription_report.dart'; import 'package:doctor_app_flutter/models/prescription_report.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:http_interceptor/http_client_with_interceptor.dart'; import 'package:http_interceptor/http_client_with_interceptor.dart';
@ -33,7 +32,6 @@ import '../models/patient/vital_sign_res_model.dart';
import '../util/helpers.dart'; import '../util/helpers.dart';
Helpers helpers = Helpers(); Helpers helpers = Helpers();
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class PatientsProvider with ChangeNotifier { class PatientsProvider with ChangeNotifier {
bool isLoading = false; bool isLoading = false;

@ -56,7 +56,7 @@ class _LoginsreenState extends State<Loginsreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.CONTEX = context;
getSharedPref(); getSharedPref();
return AppScaffold( return AppScaffold(
isLoading: _isLoading, isLoading: _isLoading,

@ -74,22 +74,12 @@ class DrAppSharedPreferances {
return prefs.getInt(key); return prefs.getInt(key);
} }
getObj(String key) async { getObj(String key) async{
final SharedPreferences prefs = await _prefs; final SharedPreferences prefs = await _prefs;
var string = prefs.getString(key); var string = prefs.getString(key);
if (string == null) { if (string == null ){
return null; return null;
} }
return json.decode(string); return json.decode(string);
} }
clear() async {
final SharedPreferences prefs = await _prefs;
prefs.clear();
}
remove(String key) async {
final SharedPreferences prefs = await _prefs;
prefs.remove(key);
}
} }

@ -1,16 +1,12 @@
import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.dart'; import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:doctor_app_flutter/config/config.dart';
import '../config/size_config.dart'; import '../config/size_config.dart';
import '../util/dr_app_toast_msg.dart'; import '../util/dr_app_toast_msg.dart';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
/* /*
*@author: Elham Rababah *@author: Elham Rababah
@ -52,6 +48,10 @@ class Helpers {
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
// padding: const EdgeInsets.symmetric(
// horizontal: 16.0,
// vertical: 5.0,
// ),
), ),
CupertinoButton( CupertinoButton(
child: Text( child: Text(
@ -97,7 +97,7 @@ class Helpers {
children: items.map((item) { children: items.map((item) {
return Text( return Text(
'${item["$decKey"]}', '${item["$decKey"]}',
style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), style: TextStyle(fontSize: SizeConfig.textMultiplier * 3),
); );
}).toList(), }).toList(),
@ -164,15 +164,14 @@ class Helpers {
), ),
); );
} }
/*
/*
*@author: Amjad Amireh *@author: Amjad Amireh
*@Date:5/5/2020 *@Date:5/5/2020
*@param: checkDate *@param: checkDate
*@return: DateTime *@return: DateTime
*@desc: convert String to DateTime *@desc: convert String to DateTime
*/ */
static String checkDate(String dateString) { static String checkDate(String dateString) {
DateTime checkedTime = DateTime.parse(dateString); DateTime checkedTime = DateTime.parse(dateString);
DateTime currentTime = DateTime.now(); DateTime currentTime = DateTime.now();
@ -258,7 +257,6 @@ class Helpers {
return "Sunday"; return "Sunday";
} }
} }
/* /*
*@author: Mohammad Aljammal *@author: Mohammad Aljammal
*@Date:26/5/2020 *@Date:26/5/2020
@ -277,7 +275,6 @@ class Helpers {
else else
return ""; return "";
} }
/* /*
*@author: Mohammad Aljammal *@author: Mohammad Aljammal
*@Date:26/5/2020 *@Date:26/5/2020
@ -304,14 +301,13 @@ class Helpers {
*@return: List<WorkingHours> *@return: List<WorkingHours>
*@desc: convert workingHours string to List<WorkingHours> *@desc: convert workingHours string to List<WorkingHours>
*/ */
static List<WorkingHours> getWorkingHours(String workingHours) { static List<WorkingHours> getWorkingHours(String workingHours ){
List<WorkingHours> myWorkingHours = []; List<WorkingHours> myWorkingHours =[];
List<String> listOfHours = workingHours.split('a'); List<String> listOfHours = workingHours.split('a');
listOfHours.forEach((element) { listOfHours.forEach((element) {
WorkingHours workingHours = WorkingHours(); WorkingHours workingHours = WorkingHours();
var from = element.substring( var from = element.substring(element.indexOf('m ') + 2 , element.indexOf('To')-2);
element.indexOf('m ') + 2, element.indexOf('To') - 2);
workingHours.from = from.trim(); workingHours.from = from.trim();
var to = element.substring(element.indexOf('To') + 2); var to = element.substring(element.indexOf('To') + 2);
workingHours.to = to.trim(); workingHours.to = to.trim();
@ -320,6 +316,9 @@ class Helpers {
return myWorkingHours; return myWorkingHours;
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:12/5/2020 *@Date:12/5/2020
@ -334,13 +333,4 @@ class Helpers {
} }
return localMsg; return localMsg;
} }
clearSharedPref() async {
await sharedPref.clear();
}
logout() async {
await clearSharedPref();
Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN);
}
} }

@ -54,15 +54,17 @@ class _LoginFormState extends State<LoginForm> {
void initState() { void initState() {
super.initState(); super.initState();
initPlatformState(); initPlatformState();
} }
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (_isInit) { if (_isInit) {
if (projectsList.length == 0) { if (projectsList.length == 0) {
getProjectsList(); getProjectsList();
} }
} }
_isInit = false; _isInit = false;
} }
@ -97,9 +99,8 @@ class _LoginFormState extends State<LoginForm> {
userInfo.UserID = value.trim(); userInfo.UserID = value.trim();
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).nextFocus(); FocusScope.of(context).requestFocus(focusPass);
}, },
autofocus: false,
), ),
buildSizedBox(), buildSizedBox(),
TextFormField( TextFormField(
@ -118,7 +119,7 @@ class _LoginFormState extends State<LoginForm> {
userInfo.Password = value; userInfo.Password = value;
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).nextFocus(); FocusScope.of(context).requestFocus(focusProject);
helpers.showCupertinoPicker( helpers.showCupertinoPicker(
context, projectsList, 'Name', onSelectProject); context, projectsList, 'Name', onSelectProject);
}, },
@ -143,8 +144,22 @@ class _LoginFormState extends State<LoginForm> {
}), }),
buildSizedBox(), buildSizedBox(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Checkbox(
value: true,
activeColor: Theme.of(context).primaryColor,
onChanged: (bool newValue) {}),
Text("Remember me",
style: TextStyle(
fontSize: 2 * SizeConfig.textMultiplier)),
],
),
),
RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
login(context, authProv, widget.changeLoadingStata); login(context, authProv, widget.changeLoadingStata);
@ -189,26 +204,17 @@ class _LoginFormState extends State<LoginForm> {
*/ */
InputDecoration buildInputDecoration(BuildContext context, hint, asset) { InputDecoration buildInputDecoration(BuildContext context, hint, asset) {
return InputDecoration( return InputDecoration(
prefixIcon: Image.asset(asset), prefixIcon: Image.asset(asset),
hintText: hint, hintText: hint,
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')), borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor), 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() { SizedBox buildSizedBox() {
@ -218,11 +224,6 @@ class _LoginFormState extends State<LoginForm> {
} }
login(context, AuthProvider authProv, Function changeLoadingStata) { login(context, AuthProvider authProv, Function changeLoadingStata) {
FocusScopeNode currentFocus = FocusScope.of(context);
// if (!currentFocus.hasPrimaryFocus) {
// currentFocus.unfocus();
// }
changeLoadingStata(true); changeLoadingStata(true);
if (loginFormKey.currentState.validate()) { if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save(); loginFormKey.currentState.save();
@ -236,7 +237,7 @@ class _LoginFormState extends State<LoginForm> {
sharedPref.setString(TOKEN, res['LogInTokenID']); sharedPref.setString(TOKEN, res['LogInTokenID']);
print("token" + res['LogInTokenID']); print("token" + res['LogInTokenID']);
Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS); Navigator.of(context).pushNamed(VERIFICATION_METHODS);
} else { } else {
// handel error // handel error
// widget.showCenterShortLoadingToast("watting"); // widget.showCenterShortLoadingToast("watting");
@ -246,7 +247,7 @@ class _LoginFormState extends State<LoginForm> {
}).catchError((err) { }).catchError((err) {
print('$err'); print('$err');
changeLoadingStata(false); changeLoadingStata(false);
helpers.showErrorToast(err); helpers.showErrorToast();
}); });
} else { } else {
changeLoadingStata(false); changeLoadingStata(false);

@ -264,25 +264,16 @@ class _VerifyAccountState extends State<VerifyAccount> {
*/ */
InputDecoration buildInputDecoration(BuildContext context) { InputDecoration buildInputDecoration(BuildContext context) {
return InputDecoration( return InputDecoration(
// ts/images/password_icon.png // ts/images/password_icon.png
contentPadding: EdgeInsets.only(top: 30, bottom: 30), contentPadding: EdgeInsets.only(top: 30, bottom: 30),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(color: Colors.black),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor), 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),
),
);
} }
/* /*
@ -331,7 +322,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
verifyAccountFormValue['digit4']; verifyAccountFormValue['digit4'];
print(activationCode); print(activationCode);
int projectID = await sharedPref.getInt(PROJECT_ID); int projectID = await sharedPref.getInt(PROJECT_ID);
Map<String, dynamic> model = { Map<String,dynamic> model = {
"activationCode": activationCode, "activationCode": activationCode,
"DoctorID": _loggedUser['DoctorID'], "DoctorID": _loggedUser['DoctorID'],
"LogInTokenID": _loggedUser['LogInTokenID'], "LogInTokenID": _loggedUser['LogInTokenID'],
@ -390,7 +381,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
Map<String, dynamic> profile, Function changeLoadingStata) { Map<String, dynamic> profile, Function changeLoadingStata) {
changeLoadingStata(false); changeLoadingStata(false);
sharedPref.setObj(DOCTOR_PROFILE, profile); sharedPref.setObj(DOCTOR_PROFILE, profile);
Navigator.of(context).pushReplacementNamed(HOME); Navigator.of(context).pushNamed(HOME);
} }
Future<dynamic> _asyncSimpleDialog( Future<dynamic> _asyncSimpleDialog(

@ -251,7 +251,6 @@ class _VerificationMethodsState extends State<VerificationMethods> {
*@desc: send Activation Code By Otp Notification Type *@desc: send Activation Code By Otp Notification Type
*/ */
sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) { sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) {
// TODO : build enum for verfication method // TODO : build enum for verfication method
if (oTPSendType == 1 || oTPSendType == 2) { if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(true); widget.changeLoadingStata(true);
@ -271,7 +270,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
widget.changeLoadingStata(false); widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model}); Navigator.of(context).pushNamed(VERIFY_ACCOUNT, arguments: {'model':model});
} else { } else {
print(res['ErrorEndUserMessage']); print(res['ErrorEndUserMessage']);
helpers.showErrorToast(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']);

Loading…
Cancel
Save