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/helpers.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:http_interceptor/http_methods.dart';
import 'package:http_interceptor/models/request_data.dart';
@ -52,7 +51,7 @@ class BaseAppClient {
// if (!body.containsKey('ClinicID'))
body['ClinicID'] = doctorProfile?.clinicID;
}
body['TokenID'] = token ?? '';
body['TokenID'] = token?? '';
body['LanguageID'] = LANGUAGE_ID;
body['stamp'] = STAMP;
body['IPAdress'] = IP_ADDRESS;
@ -64,7 +63,7 @@ class BaseAppClient {
print("URL : $url");
print("Body : ${json.encode(body)}");
if (await Helpers.checkConnection()) {
if (await Helpers.checkConnection()) {
final response = await http.post(url,
body: json.encode(body),
headers: {
@ -77,7 +76,8 @@ class BaseAppClient {
} else {
var parsed = json.decode(response.body.toString());
if (!parsed['IsAuthenticated']) {
Navigator.of(AppGlobal.CONTEX).pushNamed(LOGIN);
await helpers.logout();
helpers.showErrorToast('Your session expired Please login agian');
} else if (parsed['MessageStatus'] == 1) {
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/refer_to_doctor_request.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 '../config/config.dart';
@ -25,6 +26,7 @@ import '../models/patient/vital_sign_res_model.dart';
import '../util/helpers.dart';
Helpers helpers = Helpers();
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class PatientsProvider with ChangeNotifier {
bool isLoading = false;

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

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

@ -74,12 +74,22 @@ class DrAppSharedPreferances {
return prefs.getInt(key);
}
getObj(String key) async{
getObj(String key) async {
final SharedPreferences prefs = await _prefs;
var string = prefs.getString(key);
if (string == null ){
if (string == null) {
return null;
}
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/routes.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:doctor_app_flutter/config/config.dart';
import '../config/size_config.dart';
import '../util/dr_app_toast_msg.dart';
import 'package:connectivity/connectivity.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
/*
*@author: Elham Rababah
@ -48,10 +52,6 @@ class Helpers {
onPressed: () {
Navigator.pop(context);
},
// padding: const EdgeInsets.symmetric(
// horizontal: 16.0,
// vertical: 5.0,
// ),
),
CupertinoButton(
child: Text(
@ -97,7 +97,7 @@ class Helpers {
children: items.map((item) {
return Text(
'${item["$decKey"]}',
style: TextStyle(fontSize: SizeConfig.textMultiplier * 3),
style: TextStyle(fontSize: SizeConfig.textMultiplier * 2),
);
}).toList(),
@ -164,14 +164,15 @@ class Helpers {
),
);
}
/*
/*
*@author: Amjad Amireh
*@Date:5/5/2020
*@param: checkDate
*@return: DateTime
*@desc: convert String to DateTime
*/
static String checkDate(String dateString) {
static String checkDate(String dateString) {
DateTime checkedTime = DateTime.parse(dateString);
DateTime currentTime = DateTime.now();
@ -257,6 +258,7 @@ static String checkDate(String dateString) {
return "Sunday";
}
}
/*
*@author: Mohammad Aljammal
*@Date:26/5/2020
@ -275,6 +277,7 @@ static String checkDate(String dateString) {
else
return "";
}
/*
*@author: Mohammad Aljammal
*@Date:26/5/2020
@ -301,13 +304,14 @@ static String checkDate(String dateString) {
*@return: List<WorkingHours>
*@desc: convert workingHours string to List<WorkingHours>
*/
static List<WorkingHours> getWorkingHours(String workingHours ){
List<WorkingHours> myWorkingHours =[];
static List<WorkingHours> getWorkingHours(String workingHours) {
List<WorkingHours> myWorkingHours = [];
List<String> listOfHours = workingHours.split('a');
listOfHours.forEach((element) {
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();
var to = element.substring(element.indexOf('To') + 2);
workingHours.to = to.trim();
@ -316,9 +320,6 @@ static String checkDate(String dateString) {
return myWorkingHours;
}
/*
*@author: Elham Rababah
*@Date:12/5/2020
@ -333,4 +334,13 @@ static String checkDate(String dateString) {
}
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() {
super.initState();
initPlatformState();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
if (_isInit) {
if (projectsList.length == 0) {
getProjectsList();
}
if (projectsList.length == 0) {
getProjectsList();
}
}
_isInit = false;
}
@ -99,8 +97,9 @@ class _LoginFormState extends State<LoginForm> {
userInfo.UserID = value.trim();
},
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusPass);
FocusScope.of(context).nextFocus();
},
autofocus: false,
),
buildSizedBox(),
TextFormField(
@ -119,7 +118,7 @@ class _LoginFormState extends State<LoginForm> {
userInfo.Password = value;
},
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusProject);
FocusScope.of(context).nextFocus();
helpers.showCupertinoPicker(
context, projectsList, 'Name', onSelectProject);
},
@ -144,22 +143,8 @@ class _LoginFormState extends State<LoginForm> {
}),
buildSizedBox(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.end,
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(
onPressed: () {
login(context, authProv, widget.changeLoadingStata);
@ -204,17 +189,26 @@ class _LoginFormState extends State<LoginForm> {
*/
InputDecoration buildInputDecoration(BuildContext context, hint, asset) {
return InputDecoration(
prefixIcon: Image.asset(asset),
hintText: hint,
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
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),
));
prefixIcon: Image.asset(asset),
hintText: hint,
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
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() {
@ -224,6 +218,11 @@ class _LoginFormState extends State<LoginForm> {
}
login(context, AuthProvider authProv, Function changeLoadingStata) {
FocusScopeNode currentFocus = FocusScope.of(context);
// if (!currentFocus.hasPrimaryFocus) {
// currentFocus.unfocus();
// }
changeLoadingStata(true);
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
@ -237,7 +236,7 @@ class _LoginFormState extends State<LoginForm> {
sharedPref.setString(TOKEN, res['LogInTokenID']);
print("token" + res['LogInTokenID']);
Navigator.of(context).pushNamed(VERIFICATION_METHODS);
Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS);
} else {
// handel error
// widget.showCenterShortLoadingToast("watting");
@ -247,7 +246,7 @@ class _LoginFormState extends State<LoginForm> {
}).catchError((err) {
print('$err');
changeLoadingStata(false);
helpers.showErrorToast();
helpers.showErrorToast(err);
});
} else {
changeLoadingStata(false);

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

@ -251,6 +251,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
*@desc: send Activation Code By Otp Notification Type
*/
sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) {
// TODO : build enum for verfication method
if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(true);
@ -270,7 +271,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) {
Navigator.of(context).pushNamed(VERIFY_ACCOUNT, arguments: {'model':model});
Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model});
} else {
print(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:flutter/material.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/custom_shape_clipper.dart';
class AppScaffold extends StatelessWidget {
String appBarTitle;
@ -18,6 +14,7 @@ class AppScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppGlobal.CONTEX = context;
return Scaffold(
backgroundColor: Hexcolor('#F5F5F5'),
appBar: appBarTitle != ''

Loading…
Cancel
Save