Merge branch 'elham' into 'master'

add verification methods first step

See merge request Cloud_Solution/doctor_app_flutter!13
merge-requests/14/merge
Elham 6 years ago
commit 0b333be58a

@ -27,12 +27,14 @@ class MyApp extends StatelessWidget {
child: MaterialApp( child: MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
primaryColor: Color(0xff58434F), primaryColor: Hexcolor('#B8382C'),
buttonColor: Color(0xff58434F), buttonColor: Hexcolor('#B8382C'),
fontFamily: 'WorkSans',), fontFamily: 'WorkSans',
),
initialRoute: INIT_ROUTE, initialRoute: INIT_ROUTE,
routes: routes, routes: routes,
debugShowCheckedModeBanner: false,
), ),
); );
}); });

@ -14,6 +14,10 @@ const INSERT_DEVICE_IMEI =
const SELECT_DEVICE_IMEI = const SELECT_DEVICE_IMEI =
'https://hmgwebservices.com/Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; 'https://hmgwebservices.com/Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI';
const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
'https://hmgwebservices.com/Services/Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType';
const MEMBER_CHECK_ACTIVATION_CODE_NEW ='https://hmgwebservices.com/Services/Sentry.svc/REST/MemberCheckActivationCode_New';
class AuthProvider with ChangeNotifier { class AuthProvider with ChangeNotifier {
Client client = Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
@ -63,4 +67,28 @@ class AuthProvider with ChangeNotifier {
throw error; throw error;
} }
} }
Future<Map> sendActivationCodeByOtpNotificationType(activationCodeModel) async{
const url = SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE;
try {
final response = await client.post(url, body: json.encode(activationCodeModel));
return Future.value(json.decode(response.body));
} catch (error) {
print(error);
throw error;
}
}
Future<Map> memberCheckActivationCodeNew(activationCodeModel) async{
const url = MEMBER_CHECK_ACTIVATION_CODE_NEW;
try {
final response = await client.post(url, body: json.encode(activationCodeModel));
return Future.value(json.decode(response.body));
} catch (error) {
print(error);
throw error;
}
}
} }

@ -1,11 +1,12 @@
import './screens/QR_reader_screen.dart'; import './screens/QR_reader_screen.dart';
import './screens/auth/change_password_screen.dart'; import './screens/auth/change_password_screen.dart';
import './screens/auth/login_screen.dart'; import './screens/auth/login_screen.dart';
import './screens/auth/verification_methods_screen.dart'; import './screens/auth/verification_methods_screen.dart';
import './screens/auth/verify_account_screen.dart'; import './screens/auth/verify_account_screen.dart';
import './screens/blood_bank_screen.dart'; import './screens/blood_bank_screen.dart';
import './screens/doctor_reply_screen.dart';
import './screens/dashboard_screen.dart'; import './screens/dashboard_screen.dart';
import './screens/doctor_reply_screen.dart';
import './screens/medicine/medicine_search_screen.dart'; import './screens/medicine/medicine_search_screen.dart';
import './screens/my_schedule_screen.dart'; import './screens/my_schedule_screen.dart';
import './screens/patients/patient_search_screen.dart'; import './screens/patients/patient_search_screen.dart';
@ -26,6 +27,7 @@ const String BLOOD_BANK = 'blood-bank';
const String DOCTOR_REPLY = 'doctor-reply'; const String DOCTOR_REPLY = 'doctor-reply';
const String MEDICINE_SEARCH = 'medicine-search'; const String MEDICINE_SEARCH = 'medicine-search';
const String SETTINGS = 'settings'; const String SETTINGS = 'settings';
const LOADER ='loader';
var routes = { var routes = {
HOME: (_) => DashboardScreen(), HOME: (_) => DashboardScreen(),

@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -9,6 +8,7 @@ import '../../util/dr_app_shared_pref.dart';
import '../../widgets/auth/auth_header.dart'; import '../../widgets/auth/auth_header.dart';
import '../../widgets/auth/known_user_login.dart'; import '../../widgets/auth/known_user_login.dart';
import '../../widgets/auth/login_form.dart'; import '../../widgets/auth/login_form.dart';
import '../../widgets/shared/app_scaffold_widget.dart';
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
@ -22,9 +22,10 @@ class _LoginsreenState extends State<Loginsreen> {
Future<SharedPreferences> _prefs = SharedPreferences.getInstance(); Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
String platformImei; String platformImei;
Future<String> platformImeiFuture; Future<String> platformImeiFuture;
bool _isLoading = false;
Future<void> getSharedPref() async { Future<void> getSharedPref() async {
sharedPref.getString('platformImei').then((imei) { sharedPref.getString('platformImei').then((imei) {
platformImei = imei; platformImei = imei;
@ -39,11 +40,25 @@ class _LoginsreenState extends State<Loginsreen> {
}); });
} }
/*
*@author: Elham Rababah
*@Date:19/4/2020
*@param: isLoading
*@return:
*@desc: Change Isloading attribute in order to show or hide loader
*/
void changeLoadingStata(isLoading) {
setState(() {
_isLoading = isLoading;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
getSharedPref(); getSharedPref();
return AppScaffold( return AppScaffold(
pageOnly: true, pageOnly: true,
isloading: _isLoading,
body: SafeArea( body: SafeArea(
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
FutureBuilder( FutureBuilder(
@ -63,12 +78,15 @@ class _LoginsreenState extends State<Loginsreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
(platformImei == null) (platformImei == null)
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AuthHeader(loginType.knownUser), AuthHeader(loginType.knownUser),
LoginForm(), LoginForm(
changeLoadingStata:
changeLoadingStata,
),
], ],
) )
: Column( : Column(

@ -12,23 +12,45 @@ import '../../widgets/auth/verification_methods.dart';
*@return: *@return:
*@desc: Verification Methods screen *@desc: Verification Methods screen
*/ */
class VerificationMethodsScreen extends StatelessWidget { class VerificationMethodsScreen extends StatefulWidget {
@override
_VerificationMethodsScreenState createState() =>
_VerificationMethodsScreenState();
}
class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
bool _isLoading = false;
/*
*@author: Elham Rababah
*@Date:19/4/2020
*@param: isLoading
*@return:
*@desc: Change Isloading attribute in order to show or hide loader
*/
void changeLoadingStata(isLoading) {
setState(() {
_isLoading = isLoading;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// return Container()];
return AppScaffold( return AppScaffold(
pageOnly: true, pageOnly: true,
isloading: _isLoading,
body: ListView(children: <Widget>[ body: ListView(children: <Widget>[
Container( Container(
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AuthHeader(loginType.verificationMethods), AuthHeader(loginType.verificationMethods),
VerificationMethods(), VerificationMethods(changeLoadingStata:
], changeLoadingStata,),
), ],
), ),
])); ),
]));
} }
} }

@ -5,25 +5,46 @@ import '../../widgets/auth/auth_header.dart';
import '../../widgets/auth/verfiy_account.dart'; import '../../widgets/auth/verfiy_account.dart';
import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/app_scaffold_widget.dart';
class VerifyAccountScreen extends StatelessWidget { class VerifyAccountScreen extends StatefulWidget {
@override
_VerifyAccountScreenState createState() => _VerifyAccountScreenState();
}
class _VerifyAccountScreenState extends State<VerifyAccountScreen> {
bool _isLoading = false;
/*
*@author: Elham Rababah
*@Date:19/4/2020
*@param: isLoading
*@return:
*@desc: Change Isloading attribute in order to show or hide loader
*/
void changeLoadingStata(isLoading) {
setState(() {
_isLoading = isLoading;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// return Container()]; // return Container()];
return AppScaffold( return AppScaffold(
isloading: _isLoading,
pageOnly: true, pageOnly: true,
body: SafeArea( body: SafeArea(
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
Container( Container(
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AuthHeader(loginType.verifyPassword), AuthHeader(loginType.verifyPassword),
VerifyAccount(), VerifyAccount(changeLoadingStata:changeLoadingStata),
], ],
), ),
), ),
]), ]),
)); ));
} }
} }

@ -24,10 +24,12 @@ import 'package:flutter_flexible_toast/flutter_flexible_toast.dart';
FlutterFlexibleToast.showToast( FlutterFlexibleToast.showToast(
message: msg, message: msg,
toastLength: Toast.LENGTH_SHORT, toastLength: Toast.LENGTH_SHORT,
toastGravity: ToastGravity.TOP,
backgroundColor: Colors.red, backgroundColor: Colors.red,
icon: ICON.CLOSE, icon: ICON.CLOSE,
fontSize: 16, fontSize: 16,
imageSize: 35, imageSize: 35,
timeInSeconds: 110,
textColor: Colors.white); textColor: Colors.white);
} }

@ -1,7 +1,10 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../config/size_config.dart';
import '../util/dr_app_toast_msg.dart';
DrAppToastMsg toastMsg = DrAppToastMsg();
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:12/4/2020 *@Date:12/4/2020
@ -56,4 +59,14 @@ class Helpers {
), ),
); );
} }
showErrorToast([msg = null]) {
String localMsg = 'Something wrong happened, please contact the admin';
if (msg != null) {
localMsg = msg.toString();
}
toastMsg.showErrorToast(localMsg);
}
} }

@ -80,12 +80,14 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
2; //res['SELECTDeviceIMEIbyIMEI_List'][0]['LogInType']; 2; //res['SELECTDeviceIMEIbyIMEI_List'][0]['LogInType'];
}).catchError((err) { }).catchError((err) {
print('${err}'); print('${err}');
toastMsg.showErrorToast(err);
}); });
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return DrAppCircularProgressIndeicator(); return DrAppCircularProgressIndeicator();
default: default:
if (snapshot.hasError) { if (snapshot.hasError) {
toastMsg.showErrorToast('Error: ${snapshot.error}');
return Text('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}');
} else { } else {
return Column( return Column(

@ -1,4 +1,3 @@
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:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
@ -14,14 +13,15 @@ import '../../providers/projects_provider.dart';
import '../../routes.dart'; import '../../routes.dart';
import '../../util/dr_app_shared_pref.dart'; import '../../util/dr_app_shared_pref.dart';
import '../../util/dr_app_toast_msg.dart'; import '../../util/dr_app_toast_msg.dart';
import '../../util/helpers.dart';
DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
DrAppToastMsg toastMsg = DrAppToastMsg(); DrAppToastMsg toastMsg = DrAppToastMsg();
Helpers helpers = Helpers(); Helpers helpers = Helpers();
class LoginForm extends StatefulWidget with DrAppToastMsg { class LoginForm extends StatefulWidget with DrAppToastMsg {
LoginForm({ LoginForm({this.changeLoadingStata});
Key key, final Function changeLoadingStata;
}) : super(key: key);
@override @override
_LoginFormState createState() => _LoginFormState(); _LoginFormState createState() => _LoginFormState();
@ -126,7 +126,7 @@ class _LoginFormState extends State<LoginForm> {
controller: projectIdController, controller: projectIdController,
onTap: () { onTap: () {
helpers.showCupertinoPicker( helpers.showCupertinoPicker(
context,projectsList, 'Desciption', onSelectProject); context, projectsList, 'Desciption', onSelectProject);
}, },
showCursor: false, showCursor: false,
readOnly: true, readOnly: true,
@ -151,9 +151,6 @@ class _LoginFormState extends State<LoginForm> {
return 'Please enter your porject'; return 'Please enter your porject';
} }
return null; return null;
},
onSaved: (value) {
userInfo.Password = value;
}), }),
buildSizedBox(), buildSizedBox(),
Row( Row(
@ -175,9 +172,9 @@ class _LoginFormState extends State<LoginForm> {
), ),
RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(VERIFICATION_METHODS); // Navigator.of(context).pushNamed(VERIFICATION_METHODS);
// login(context, authProv); login(context, authProv, widget.changeLoadingStata);
}, },
textColor: Colors.white, textColor: Colors.white,
elevation: 0.0, elevation: 0.0,
@ -216,22 +213,30 @@ class _LoginFormState extends State<LoginForm> {
); );
} }
login(context, AuthProvider authProv) { login(context, AuthProvider authProv, Function changeLoadingStata) {
changeLoadingStata(true);
if (loginFormKey.currentState.validate()) { if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save(); loginFormKey.currentState.save();
authProv.login(userInfo).then((res) { authProv.login(userInfo).then((res) {
changeLoadingStata(false);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
insertDeviceImei(res, authProv); // insertDeviceImei(res, authProv);
saveObjToString('loggedUser', res);
Navigator.of(context).pushNamed(VERIFICATION_METHODS);
} else { } else {
// handel error // handel error
// widget.showCenterShortLoadingToast("watting"); // widget.showCenterShortLoadingToast("watting");
showLoginError(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']);
} }
// Navigator.of(context).pushNamed(HOME); // Navigator.of(context).pushNamed(HOME);
}).catchError((err) { }).catchError((err) {
print('$err'); print('$err');
showLoginError(); changeLoadingStata(false);
helpers.showErrorToast();
}); });
} else {
changeLoadingStata(false);
} }
} }
@ -260,11 +265,11 @@ class _LoginFormState extends State<LoginForm> {
// save imei on shared preferance // save imei on shared preferance
} else { } else {
// handel error // handel error
showLoginError(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']);
} }
}).catchError((err) { }).catchError((err) {
print(err); print(err);
showLoginError(); helpers.showErrorToast();
}); });
} }
} }
@ -315,16 +320,6 @@ class _LoginFormState extends State<LoginForm> {
}); });
} }
showLoginError([msg = null]) {
String localMsg = 'Something wrong happened, please contact the admin';
if (msg != null) {
localMsg = msg.toString();
}
toastMsg.showErrorToast(localMsg);
}
saveObjToString(String key, value) async { saveObjToString(String key, value) async {
sharedPref.setObj(key, value); sharedPref.setObj(key, value);
} }
@ -335,5 +330,4 @@ class _LoginFormState extends State<LoginForm> {
projectIdController.text = projectsList[index]['Desciption']; projectIdController.text = projectsList[index]['Desciption'];
}); });
} }
} }

@ -1,149 +1,218 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
import '../../config/size_config.dart'; import '../../config/size_config.dart';
import '../../providers/auth_provider.dart';
import '../../routes.dart'; import '../../routes.dart';
import '../../util/dr_app_shared_pref.dart';
import '../../util/dr_app_toast_msg.dart';
import '../../util/helpers.dart';
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
class VerifyAccount extends StatelessWidget { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
DrAppToastMsg toastMsg = DrAppToastMsg();
Helpers helpers = Helpers();
class VerifyAccount extends StatefulWidget {
VerifyAccount({this.changeLoadingStata});
final Function changeLoadingStata;
@override
_VerifyAccountState createState() => _VerifyAccountState();
}
class _VerifyAccountState extends State<VerifyAccount> {
final verifyAccountForm = GlobalKey<FormState>(); final verifyAccountForm = GlobalKey<FormState>();
Map verifyAccountFormValue = {
'digit1': null,
'digit2': null,
'digit3': null,
'digit4': null,
};
Future _loggedUserFuture;
var _loggedUser;
@override
void initState() {
super.initState();
_loggedUserFuture = getSharedPref();
}
Future<void> getSharedPref() async {
sharedPref.getObj('loggedUser').then((userInfo) {
_loggedUser = userInfo;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Form( AuthProvider authProv = Provider.of<AuthProvider>(context);
key: verifyAccountForm,
child: Container( return FutureBuilder(
width: SizeConfig.realScreenWidth * 0.90, future: Future.wait([_loggedUserFuture]),
child: Column( builder: (BuildContext context, AsyncSnapshot snapshot) {
crossAxisAlignment: CrossAxisAlignment.start, switch (snapshot.connectionState) {
children: <Widget>[ case ConnectionState.waiting:
buildSizedBox(30), return DrAppCircularProgressIndeicator();
Row( default:
mainAxisAlignment: MainAxisAlignment.spaceAround, if (snapshot.hasError) {
children: <Widget>[ toastMsg.showErrorToast('Error: ${snapshot.error}');
Container( return Text('Error: ${snapshot.error}');
width:SizeConfig.realScreenWidth*0.20, } else {
child: TextFormField( return Form(
decoration: InputDecoration( key: verifyAccountForm,
// ts/images/password_icon.png child: Container(
contentPadding: width: SizeConfig.realScreenWidth * 0.90,
EdgeInsets.only(top: 30, bottom: 30), child: Column(
enabledBorder: OutlineInputBorder( crossAxisAlignment: CrossAxisAlignment.start,
borderRadius: children: <Widget>[
BorderRadius.all(Radius.circular(10)), buildSizedBox(30),
borderSide: BorderSide(color: Colors.black), Row(
), mainAxisAlignment:
focusedBorder: OutlineInputBorder( MainAxisAlignment.spaceAround,
borderRadius: children: <Widget>[
BorderRadius.all(Radius.circular(10.0)), Container(
borderSide: BorderSide( width: SizeConfig.realScreenWidth * 0.20,
color: Theme.of(context).primaryColor), child: TextFormField(
)), style: buildTextStyle(),
onChanged: (_) {}, maxLength: 1,
)), textAlign: TextAlign.center,
Container( keyboardType: TextInputType.number,
width:SizeConfig.realScreenWidth*0.20, decoration:
child: TextFormField( buildInputDecoration(context),
decoration: InputDecoration( onSaved: (val) {
// ts/images/password_icon.png verifyAccountFormValue['digit1'] =
contentPadding: val;
EdgeInsets.only(top: 30, bottom: 30), },
enabledBorder: OutlineInputBorder( validator: validateCodeDigit,
borderRadius: )),
BorderRadius.all(Radius.circular(10)), Container(
borderSide: BorderSide(color: Colors.black), width: SizeConfig.realScreenWidth * 0.20,
), child: TextFormField(
focusedBorder: OutlineInputBorder( maxLength: 1,
borderRadius: textAlign: TextAlign.center,
BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide( style: buildTextStyle(),
color: Theme.of(context).primaryColor), keyboardType: TextInputType.number,
)), decoration:
onChanged: (_) {}, buildInputDecoration(context),
)), onSaved: (val) {
Container( verifyAccountFormValue['digit2'] =
width:SizeConfig.realScreenWidth*0.20, val;
child: TextFormField( },
decoration: InputDecoration( validator: validateCodeDigit)),
// ts/images/password_icon.png Container(
contentPadding: width: SizeConfig.realScreenWidth * 0.20,
EdgeInsets.only(top: 30, bottom: 30), child: TextFormField(
enabledBorder: OutlineInputBorder( maxLength: 1,
borderRadius: textAlign: TextAlign.center,
BorderRadius.all(Radius.circular(10)), style: buildTextStyle(),
borderSide: BorderSide(color: Colors.black), keyboardType: TextInputType.number,
decoration:
buildInputDecoration(context),
onSaved: (val) {
verifyAccountFormValue['digit3'] =
val;
},
validator: validateCodeDigit)),
Container(
width: SizeConfig.realScreenWidth * 0.20,
child: TextFormField(
maxLength: 1,
textAlign: TextAlign.center,
style: buildTextStyle(),
keyboardType: TextInputType.number,
decoration:
buildInputDecoration(context),
onSaved: (val) {
verifyAccountFormValue['digit4'] =
val;
},
validator: validateCodeDigit))
],
),
// buildSizedBox(40),
buildSizedBox(20),
buildText(),
// buildSizedBox(10.0),
// Text()
buildSizedBox(40),
// buildSizedBox(),
RaisedButton(
onPressed: () {
verifyAccount(
authProv, widget.changeLoadingStata);
// Navigator.of(context).pushNamed(HOME);
},
elevation: 0.0,
child: Container(
width: double.infinity,
height: 50,
child: Center(
child: Text(
'Verfiy'.toUpperCase(),
style: TextStyle(
color: Colors.white,
fontSize:
3 * SizeConfig.textMultiplier),
),
),
), ),
focusedBorder: OutlineInputBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius: BorderRadius.circular(10),
BorderRadius.all(Radius.circular(10.0)), side: BorderSide(
borderSide: BorderSide( width: 0.5,
color: Theme.of(context).primaryColor), color: Hexcolor('#CCCCCC'))),
)), ),
onChanged: (_) {}, buildSizedBox(20),
)), Center(
Container( child: Text(
width:SizeConfig.realScreenWidth*0.20, "Resend in 4.20",
child: TextFormField( style: TextStyle(
decoration: InputDecoration( fontSize: 3.0 * SizeConfig.textMultiplier,
// 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: buildSizedBox(10),
BorderRadius.all(Radius.circular(10.0)), ])));
borderSide: BorderSide( }
color: Theme.of(context).primaryColor), }
)), });
onChanged: (_) {}, }
))
], /*
), *@author: Elham Rababah
// buildSizedBox(40), *@Date:19/4/2020
buildSizedBox(20), *@param:
buildText(), *@return:
// buildSizedBox(10.0), *@desc: change the style for the input field
// Text() */
TextStyle buildTextStyle() {
buildSizedBox(40), return TextStyle(
fontSize: SizeConfig.textMultiplier * 3,
// buildSizedBox(), );
RaisedButton( }
onPressed: () {
Navigator.of(context).pushNamed(HOME); String validateCodeDigit(value) {
}, if (value.isEmpty) {
elevation: 0.0, return 'Please enter your Password';
child: Container( }
width: double.infinity, return null;
height: 50, }
child: Center(
child: Text( InputDecoration buildInputDecoration(BuildContext context) {
'Verfiy'.toUpperCase(), return InputDecoration(
// textAlign: TextAlign.center, // ts/images/password_icon.png
style: TextStyle( contentPadding: EdgeInsets.only(top: 30, bottom: 30),
color: Colors.white, enabledBorder: OutlineInputBorder(
fontSize: 3 * SizeConfig.textMultiplier), borderRadius: BorderRadius.all(Radius.circular(10)),
), borderSide: BorderSide(color: Colors.black),
), ),
), focusedBorder: OutlineInputBorder(
shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderRadius: BorderRadius.circular(10), borderSide: BorderSide(color: Theme.of(context).primaryColor),
side: ));
BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))),
),
buildSizedBox(20),
Center(
child: Text(
"Resend in 4.20",
style: TextStyle(
fontSize: 3.0 * SizeConfig.textMultiplier,
),
),
),
buildSizedBox(10),
])));
} }
RichText buildText() { RichText buildText() {
@ -158,7 +227,7 @@ class VerifyAccount extends StatelessWidget {
style: TextStyle(fontWeight: FontWeight.w700)), style: TextStyle(fontWeight: FontWeight.w700)),
new TextSpan(text: 'By SMS, Please enter the code') new TextSpan(text: 'By SMS, Please enter the code')
])); ]));
return text; return text;
} }
SizedBox buildSizedBox([double height = 20]) { SizedBox buildSizedBox([double height = 20]) {
@ -166,4 +235,58 @@ class VerifyAccount extends StatelessWidget {
height: height, height: height,
); );
} }
/*
*@author: Elham Rababah
*@Date:15/4/2020
*@param: authProv
*@return:
*@desc: verify Account func call sendActivationCodeByOtpNotificationType service
*/
verifyAccount(AuthProvider authProv, Function changeLoadingStata) {
if (verifyAccountForm.currentState.validate()) {
changeLoadingStata(true);
verifyAccountForm.currentState.save();
final activationCode = verifyAccountFormValue['digit1'] +
verifyAccountFormValue['digit2'] +
verifyAccountFormValue['digit3'] +
verifyAccountFormValue['digit4'];
print(activationCode);
Map model = {
"activationCode": activationCode,
"DoctorID": _loggedUser['List_MemberInformation'][0]['MemberID'],
"LogInTokenID": _loggedUser['LogInTokenID'],
"ProjectID": 15,
"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
};
changeLoadingStata(true);
Navigator.of(context).pushNamed(HOME);
// authProv.memberCheckActivationCodeNew(model).then((res) {
// changeLoadingStata(false);
// if (res['MessageStatus'] == 1) {
// Navigator.of(context).pushNamed(HOME);
// } else {
// helpers.showErrorToast(res['ErrorEndUserMessage']);
// }
// }).catchError((err) {
// changeLoadingStata(false);
// print('$err');
// helpers.showErrorToast();
// });
} else {
// changeLoadingStata(false);
}
}
} }

@ -1,7 +1,16 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
import '../../config/size_config.dart';
import '../../providers/auth_provider.dart';
import '../../routes.dart';
import '../../util/dr_app_shared_pref.dart';
import '../../util/helpers.dart';
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
Helpers helpers = Helpers();
/* /*
*@author: Elham Rababah *@author: Elham Rababah
@ -10,86 +19,116 @@ import 'package:hexcolor/hexcolor.dart';
*@return: *@return:
*@desc: Verification Methods widget *@desc: Verification Methods widget
*/ */
class VerificationMethods extends StatelessWidget { class VerificationMethods extends StatefulWidget {
MainAxisAlignment spaceBetweenMethods =MainAxisAlignment.spaceBetween; VerificationMethods({this.changeLoadingStata});
final Function changeLoadingStata;
@override
_VerificationMethodsState createState() => _VerificationMethodsState();
}
class _VerificationMethodsState extends State<VerificationMethods> {
MainAxisAlignment spaceBetweenMethods = MainAxisAlignment.spaceBetween;
Future _loggedUserFuture;
var _loggedUser;
@override
void initState() {
super.initState();
_loggedUserFuture = getSharedPref();
}
Future<void> getSharedPref() async {
sharedPref.getObj('loggedUser').then((userInfo) {
_loggedUser = userInfo;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// if(!SizeConfig.isMobile) { AuthProvider authProv = Provider.of<AuthProvider>(context);
// spaceBetweenMethods = MainAxisAlignment.spaceAround; return FutureBuilder(
// } future: Future.wait([_loggedUserFuture]),
return Container( builder: (BuildContext context, AsyncSnapshot snapshot) {
width: SizeConfig.realScreenWidth * 0.90, switch (snapshot.connectionState) {
child: Column( case ConnectionState.waiting:
crossAxisAlignment: CrossAxisAlignment.start, return DrAppCircularProgressIndeicator();
children: <Widget>[ default:
Text( if (snapshot.hasError) {
"Please choose one of the Following option to verify", helpers.showErrorToast('Error: ${snapshot.error}');
style: TextStyle( return Text('Error: ${snapshot.error}');
fontSize: 3.5 * SizeConfig.textMultiplier, } else {
), return Container(
), width: SizeConfig.realScreenWidth * 0.90,
SizedBox( child: Column(
height: 40, crossAxisAlignment: CrossAxisAlignment.start,
), children: <Widget>[
Container( Text(
width: SizeConfig.realScreenWidth * 80, "Please choose one of the Following option to verify",
child: Column( style: TextStyle(
crossAxisAlignment: CrossAxisAlignment.start, fontSize: 3.5 * SizeConfig.textMultiplier,
children: <Widget>[ ),
Row( ),
mainAxisAlignment: spaceBetweenMethods, SizedBox(
children: <Widget>[ height: 40,
buildVerificationMethod(context, ),
'assets/images/verification_fingerprint_icon.png', Container(
'Fingerprint', width: SizeConfig.realScreenWidth * 80,
() {}), child: Column(
buildVerificationMethod(context, crossAxisAlignment: CrossAxisAlignment.start,
'assets/images/verification_faceid_icon.png', children: <Widget>[
'Face ID', Row(
() {}), mainAxisAlignment: spaceBetweenMethods,
], children: <Widget>[
), buildVerificationMethod(
SizedBox( context,
height: 40, 'assets/images/verification_fingerprint_icon.png',
), 'Fingerprint',
Row( () {}),
mainAxisAlignment: spaceBetweenMethods, buildVerificationMethod(
children: <Widget>[ context,
buildVerificationMethod(context, 'assets/images/verification_faceid_icon.png',
'assets/images/verification_whatsapp_icon.png', 'Face ID',
'WhatsApp', () {}),
() {}), ],
buildVerificationMethod(context, ),
'assets/images/verification_sms_icon.png', SizedBox(
'SMS', height: 40,
() {}), ),
], Row(
) mainAxisAlignment: spaceBetweenMethods,
], children: <Widget>[
), buildVerificationMethod(
), context,
SizedBox( 'assets/images/verification_whatsapp_icon.png',
height: SizeConfig.heightMultiplier * 2, 'WhatsApp', () {
) sendActivationCodeByOtpNotificationType(
], 2, authProv);
), }),
); buildVerificationMethod(
context,
'assets/images/verification_sms_icon.png',
'SMS', () {
sendActivationCodeByOtpNotificationType(
1, authProv);
}),
],
)
],
),
),
SizedBox(
height: SizeConfig.heightMultiplier * 2,
)
],
),
);
}
}
});
} }
/* InkWell buildVerificationMethod(context, url, dec, Function fun) {
*@author: Elham Rababah
*@Date:07/4/2020
*@param: url , dec, fun
*@return: InkWell widget
*@desc: Build Verification Method
*/
InkWell buildVerificationMethod(context,url, dec, fun) {
return InkWell( return InkWell(
onTap: (){ onTap: fun,
Navigator.of(context).pushNamed(VERIFY_ACCOUNT);
},
child: Container( child: Container(
// height: SizeConfig.heightMultiplier *2, // height: SizeConfig.heightMultiplier *2,
height: SizeConfig.heightMultiplier * 19, height: SizeConfig.heightMultiplier * 19,
@ -117,10 +156,58 @@ class VerificationMethods extends StatelessWidget {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Text(dec, style: TextStyle(fontSize:SizeConfig.textMultiplier*2 ),) Text(
dec,
style: TextStyle(fontSize: SizeConfig.textMultiplier * 2),
)
], ],
), ),
), ),
); );
} }
/*
*@author: Elham Rababah
*@Date:15/4/2020
*@param: oTPSendType
*@return:
*@desc: send Activation Code By Otp Notification Type
*/
sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) {
widget.changeLoadingStata(true);
// TODO : build enum for verfication method
if (oTPSendType == 1 || oTPSendType == 2) {
Map model = {
"LogInTokenID": _loggedUser['LogInTokenID'],
"Channel": 9,
"MobileNumber": 785228065, //_loggedUser['MobileNumber'],
"IPAdress": "11.11.11.11",
"LanguageID": 2,
"ProjectID": 15, //TODO : this should become daynamci
"ZipCode": 962, //_loggedUser['ZipCode'],
"UserName": _loggedUser['List_MemberInformation'][0]['MemberID'],
"OTP_SendType": oTPSendType
};
print('$_loggedUser');
print(oTPSendType);
authProv.sendActivationCodeByOtpNotificationType(model).then((res) {
// Navigator.of(context).pushNamed(VERIFY_ACCOUNT);
widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) {
Navigator.of(context).pushNamed(VERIFY_ACCOUNT);
} else {
helpers.showErrorToast(res['ErrorEndUserMessage']);
}
// Navigator.of(context).pushNamed(HOME);
}).catchError((err) {
print('$err');
widget.changeLoadingStata(false);
helpers.showErrorToast();
});
} else {
// TODO route to this page with parameters to inicate we should present 2 option
}
}
} }

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:progress_hud_v2/progress_hud.dart';
/*
*@author: Elham Rababah
*@Date:19/4/2020
*@param:
*@return: Positioned
*@desc: AppLoaderWidget to create loader
*/
class AppLoaderWidget extends StatefulWidget {
AppLoaderWidget({Key key, this.title}) : super(key: key);
final String title;
@override
_AppLoaderWidgetState createState() => new _AppLoaderWidgetState();
}
class _AppLoaderWidgetState extends State<AppLoaderWidget> {
ProgressHUD _progressHUD;
@override
void initState() {
super.initState();
/*
*@author: Elham Rababah
*@Date:19/4/2020
*@param:
*@return:
*@desc: create loader the desing
*/
_progressHUD = new ProgressHUD(
backgroundColor: Colors.black12,
color: Colors.black,
// containerColor: Colors.blue,
borderRadius: 5.0,
// text: 'Loading...',
);
}
@override
Widget build(BuildContext context) {
return Positioned(child: _progressHUD);
}
}

@ -1,10 +1,11 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:flutter/material.dart';
import 'package:doctor_app_flutter/screens/patients/patients_screen.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../config/size_config.dart';
import '../../presentation/doctor_app_icons.dart'; import '../../presentation/doctor_app_icons.dart';
import '../../screens/patients/patients_screen.dart';
import '../../widgets/shared/app_drawer_widget.dart'; import '../../widgets/shared/app_drawer_widget.dart';
import 'package:flutter/material.dart'; import '../../widgets/shared/app_loader_widget.dart';
class AppScaffold extends StatelessWidget { class AppScaffold extends StatelessWidget {
bool pageOnly = false; bool pageOnly = false;
@ -16,6 +17,7 @@ class AppScaffold extends StatelessWidget {
bool showCurve = true; bool showCurve = true;
String appBarTitle = ''; String appBarTitle = '';
Widget body; Widget body;
bool isloading = false;
AppScaffold( AppScaffold(
{this.pageOnly, {this.pageOnly,
@ -25,7 +27,8 @@ class AppScaffold extends StatelessWidget {
this.showAppDrawer, this.showAppDrawer,
this.body, this.body,
this.showbg, this.showbg,
this.showCurve}); this.showCurve,
this.isloading = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -83,7 +86,7 @@ class AppScaffold extends StatelessWidget {
icon: Icon(Icons.apps), title: Text('Menu')) icon: Icon(Icons.apps), title: Text('Menu'))
]), ]),
body: (pageOnly == true || showCurve == false) body: (pageOnly == true || showCurve == false)
? body ? Stack(children: <Widget>[body, buildAppLoaderWidget(isloading)])
: Stack( : Stack(
children: <Widget>[ children: <Widget>[
ClipPath( ClipPath(
@ -95,10 +98,13 @@ class AppScaffold extends StatelessWidget {
Positioned( Positioned(
// key: , // key: ,
// top: SizeConfig.realScreenHeight * 0.10, // top: SizeConfig.realScreenHeight * 0.10,
child: body) child: body),
buildAppLoaderWidget(isloading)
], ],
)); ));
} }
}
Widget buildAppLoaderWidget(bool isloading) {
return isloading ? AppLoaderWidget() : Container();
}
}

@ -429,6 +429,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.4.0" version: "1.4.0"
progress_hud_v2:
dependency: "direct main"
description:
name: progress_hud_v2
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
protobuf: protobuf:
dependency: transitive dependency: transitive
description: description:

@ -30,7 +30,7 @@ dependencies:
flutter_flexible_toast: ^0.1.4 flutter_flexible_toast: ^0.1.4
local_auth: ^0.6.1+3 local_auth: ^0.6.1+3
http_interceptor: ^0.2.0 http_interceptor: ^0.2.0
progress_hud_v2: ^2.0.0
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.

Loading…
Cancel
Save