Merge branch 'elham' into 'development'

Elham

See merge request Cloud_Solution/doctor_app_flutter!107
merge-requests/109/merge
Elham 6 years ago
commit b34aec65b8

@ -7,7 +7,6 @@ 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';
@ -52,7 +51,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;
@ -64,7 +63,7 @@ class BaseAppClient {
print("URL : $url"); print("URL : $url");
print("Body : ${json.encode(body)}"); print("Body : ${json.encode(body)}");
if (await Helpers.checkConnection()) { if (await Helpers.checkConnection()) {
final response = await http.post(url, final response = await http.post(url,
body: json.encode(body), body: json.encode(body),
headers: { headers: {
@ -77,7 +76,8 @@ class BaseAppClient {
} else { } else {
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
if (!parsed['IsAuthenticated']) { if (!parsed['IsAuthenticated']) {
Navigator.of(AppGlobal.CONTEX).pushNamed(LOGIN); await helpers.logout();
helpers.showErrorToast('Your session expired Please login agian'); helpers.showErrorToast('Your session expired Please login agian');
} else if (parsed['MessageStatus'] == 1) { } else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);

@ -13,6 +13,7 @@ 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 '../config/config.dart'; import '../config/config.dart';
@ -25,6 +26,7 @@ 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,

@ -36,13 +36,18 @@ class _DashboardScreenState extends State<DashboardScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
projectsProvider = Provider.of(context); projectsProvider = Provider.of(context);
return SafeArea( return SafeArea(
bottom: true, bottom: true,
child: Scaffold( child: Scaffold(
body: SingleChildScrollView( body: SingleChildScrollView(
child: SizedBox( child: SizedBox(
height: MediaQuery.of(context).size.height*1.09, height: MediaQuery.of(context).size.height * 1.09,
// height: MediaQuery.of(context).size.height * 0.2, // height: MediaQuery.of(context).size.height * 0.2,
// width: SizeConfig.screenWidth * 0.9, // width: SizeConfig.screenWidth * 0.9,
child: Column( child: Column(
@ -101,16 +106,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
flex: 1, flex: 1,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.stretch, CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: DashboardItemTexts( child: DashboardItemTexts(
TranslationBase.of(context).arrived, TranslationBase.of(context).arrived,
"23", "23",
)), )),
Expanded( Expanded(
child: DashboardItemTexts( child: DashboardItemTexts(
TranslationBase.of(context).notArrived, TranslationBase.of(context)
.notArrived,
"23", "23",
), ),
), ),
@ -119,18 +125,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
), ),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.stretch, CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: DashboardItemTexts( child: DashboardItemTexts(
TranslationBase.of(context).er, TranslationBase.of(context).er,
"23", "23",
)), )),
Expanded( Expanded(
child: DashboardItemTexts( child: DashboardItemTexts(
TranslationBase.of(context).walkIn,
TranslationBase.of(context).walkIn,
"23", "23",
)), )),
], ],

@ -74,12 +74,22 @@ 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,12 +1,16 @@
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
@ -48,10 +52,6 @@ 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 * 3), style: TextStyle(fontSize: SizeConfig.textMultiplier * 2),
); );
}).toList(), }).toList(),
@ -164,14 +164,15 @@ 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();
@ -257,6 +258,7 @@ static String checkDate(String dateString) {
return "Sunday"; return "Sunday";
} }
} }
/* /*
*@author: Mohammad Aljammal *@author: Mohammad Aljammal
*@Date:26/5/2020 *@Date:26/5/2020
@ -275,6 +277,7 @@ static String checkDate(String dateString) {
else else
return ""; return "";
} }
/* /*
*@author: Mohammad Aljammal *@author: Mohammad Aljammal
*@Date:26/5/2020 *@Date:26/5/2020
@ -301,13 +304,14 @@ static String checkDate(String dateString) {
*@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(element.indexOf('m ') + 2 , element.indexOf('To')-2); var from = element.substring(
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();
@ -316,9 +320,6 @@ static String checkDate(String dateString) {
return myWorkingHours; return myWorkingHours;
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:12/5/2020 *@Date:12/5/2020
@ -333,4 +334,13 @@ static String checkDate(String dateString) {
} }
return localMsg; return localMsg;
} }
clearSharedPref() async {
await sharedPref.clear();
}
logout() async {
await clearSharedPref();
Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN);
}
} }

@ -54,17 +54,15 @@ 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;
} }
@ -99,8 +97,9 @@ class _LoginFormState extends State<LoginForm> {
userInfo.UserID = value.trim(); userInfo.UserID = value.trim();
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusPass); FocusScope.of(context).nextFocus();
}, },
autofocus: false,
), ),
buildSizedBox(), buildSizedBox(),
TextFormField( TextFormField(
@ -119,7 +118,7 @@ class _LoginFormState extends State<LoginForm> {
userInfo.Password = value; userInfo.Password = value;
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusProject); FocusScope.of(context).nextFocus();
helpers.showCupertinoPicker( helpers.showCupertinoPicker(
context, projectsList, 'Name', onSelectProject); context, projectsList, 'Name', onSelectProject);
}, },
@ -144,22 +143,8 @@ class _LoginFormState extends State<LoginForm> {
}), }),
buildSizedBox(), buildSizedBox(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.end,
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);
@ -204,17 +189,26 @@ 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() {
@ -224,6 +218,11 @@ 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();
@ -237,7 +236,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).pushNamed(VERIFICATION_METHODS); Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS);
} else { } else {
// handel error // handel error
// widget.showCenterShortLoadingToast("watting"); // widget.showCenterShortLoadingToast("watting");
@ -247,7 +246,7 @@ class _LoginFormState extends State<LoginForm> {
}).catchError((err) { }).catchError((err) {
print('$err'); print('$err');
changeLoadingStata(false); changeLoadingStata(false);
helpers.showErrorToast(); helpers.showErrorToast(err);
}); });
} else { } else {
changeLoadingStata(false); changeLoadingStata(false);

@ -264,16 +264,25 @@ 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),
),
);
} }
/* /*
@ -322,7 +331,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'],
@ -381,7 +390,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).pushNamed(HOME); Navigator.of(context).pushReplacementNamed(HOME);
} }
Future<dynamic> _asyncSimpleDialog( Future<dynamic> _asyncSimpleDialog(

@ -251,6 +251,7 @@ 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);
@ -270,7 +271,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
widget.changeLoadingStata(false); widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
Navigator.of(context).pushNamed(VERIFY_ACCOUNT, arguments: {'model':model}); Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model});
} else { } else {
print(res['ErrorEndUserMessage']); print(res['ErrorEndUserMessage']);
helpers.showErrorToast(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']);

@ -1,13 +1,9 @@
import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../config/size_config.dart';
import '../../presentation/doctor_app_icons.dart';
import '../../widgets/shared/app_drawer_widget.dart';
import '../../widgets/shared/app_loader_widget.dart'; import '../../widgets/shared/app_loader_widget.dart';
import '../../widgets/shared/custom_shape_clipper.dart';
class AppScaffold extends StatelessWidget { class AppScaffold extends StatelessWidget {
String appBarTitle; String appBarTitle;
@ -18,6 +14,7 @@ class AppScaffold extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.CONTEX = context;
return Scaffold( return Scaffold(
backgroundColor: Hexcolor('#F5F5F5'), backgroundColor: Hexcolor('#F5F5F5'),
appBar: appBarTitle != '' appBar: appBarTitle != ''

Loading…
Cancel
Save