diff --git a/.gitignore b/.gitignore index ae1f1838..c8e6bcd9 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ @@ -35,3 +35,5 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +.vscode/settings.json +.vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..4969fedb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "commentBox.styles": { + "defaultStyle": { + "commentStartToken": "/* \n *@author: Elham Rababah \n *@Date:13/4/1993 \n *@param: \n *@return:\n *@desc: ", + "commentEndToken": "\n */", + "leftEdgeToken": " * ", + "rightEdgeToken": "", + "topEdgeToken": "", + "bottomEdgeToken": "", + "topRightToken": "", + "bottomLeftToken": "", + "capitalize": false, + "textAlignment": "left" + }} + +} \ No newline at end of file diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index b029c89c..6b996b3f 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -5,6 +5,8 @@ class SizeConfig { static double _blockWidth = 0; static double _blockHeight = 0; + static double realScreenWidth; + static double realScreenHeight; static double screenWidth; static double screenHeight; static double textMultiplier; @@ -17,33 +19,40 @@ class SizeConfig { static bool isMobile = false; void init(BoxConstraints constraints, Orientation orientation) { + realScreenHeight = constraints.maxHeight; + realScreenWidth = constraints.maxWidth; - screenHeight = constraints.maxHeight; - screenWidth = constraints.maxWidth; - _blockWidth = screenWidth / 100; - _blockHeight = screenHeight / 100; - if(constraints.maxWidth<= MAX_SMALL_SCREEN){ + if (constraints.maxWidth <= MAX_SMALL_SCREEN) { isMobile = true; } if (orientation == Orientation.portrait) { isPortrait = true; - if (screenWidth < 450) { + if (realScreenWidth < 450) { isMobilePortrait = true; } - textMultiplier = _blockHeight; - imageSizeMultiplier = _blockWidth; + // textMultiplier = _blockHeight; + // imageSizeMultiplier = _blockWidth; + screenHeight = realScreenHeight; + screenWidth = realScreenWidth; } else { isPortrait = false; isMobilePortrait = false; - textMultiplier = _blockWidth; - imageSizeMultiplier = _blockHeight; + // textMultiplier = _blockWidth; + // imageSizeMultiplier = _blockHeight; + screenHeight = realScreenWidth; + screenWidth = realScreenHeight; } + _blockWidth = screenWidth / 100; + _blockHeight = screenHeight / 100; + + textMultiplier = _blockHeight; + imageSizeMultiplier = _blockWidth; heightMultiplier = _blockHeight; widthMultiplier = _blockWidth; - print('screenWidth $screenWidth'); - print('screenHeight $screenHeight'); + print('realScreenWidth $realScreenWidth'); + print('realScreenHeight $realScreenHeight'); print('textMultiplier $textMultiplier'); print('imageSizeMultiplier $imageSizeMultiplier'); print('heightMultiplier$heightMultiplier'); diff --git a/lib/lookups/auth_lookup.dart b/lib/lookups/auth_lookup.dart index bc4d3821..058b2888 100644 --- a/lib/lookups/auth_lookup.dart +++ b/lib/lookups/auth_lookup.dart @@ -1 +1,7 @@ -enum loginType { knownUser, unknownUser, changePassword, verifyPassword } +enum loginType { + knownUser, + unknownUser, + changePassword, + verifyPassword, + verificationMethods +} diff --git a/lib/main.dart b/lib/main.dart index a89541b8..180875fe 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -31,7 +31,7 @@ class MyApp extends StatelessWidget { primarySwatch: Colors.blue, primaryColor: Hexcolor('#B8382C'), buttonColor: Hexcolor('#B8382C'), - fontFamily: 'WorkSans'), + fontFamily: 'WorkSans',), initialRoute: INIT_ROUTE, routes: routes, ), diff --git a/lib/routes.dart b/lib/routes.dart index 60e40fbd..7dbcca3f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,7 +1,8 @@ -import 'package:doctor_app_flutter/screens/settings/settings_screen.dart'; - import './screens/QR_reader_screen.dart'; +import './screens/auth/change_password_screen.dart'; import './screens/auth/login_screen.dart'; +import './screens/auth/verification_methods_screen.dart'; +import './screens/auth/verify_account_screen.dart'; import './screens/blood_bank_screen.dart'; import './screens/doctor_reply_screen.dart'; import './screens/dashboard_screen.dart'; @@ -9,14 +10,14 @@ import './screens/medicine/medicine_search_screen.dart'; import './screens/my_schedule_screen.dart'; import './screens/patients/patient_search_screen.dart'; import './screens/patients/patients_list_screen.dart'; -import './screens/auth/change_password_screen.dart'; -import './screens/auth/verify_account_screen.dart'; +import './screens/settings/settings_screen.dart'; const String INIT_ROUTE = LOGIN; const String HOME = '/'; const String LOGIN = 'login'; const String CHANGE_PASSWORD = 'change-password'; const String VERIFY_ACCOUNT = 'verify-account'; +const String VERIFICATION_METHODS ='verification-methods'; const String MY_SCHEDULE = 'my-schedule'; const String QR_READER = 'qr-reader'; const String PATIENT_SEARCH = 'patients/patient-search'; @@ -39,4 +40,5 @@ var routes = { SETTINGS: (_) => SettingsScreen(), CHANGE_PASSWORD: (_) => ChangePasswordScreen(), VERIFY_ACCOUNT: (_) => VerifyAccountScreen(), + VERIFICATION_METHODS:(_)=> VerificationMethodsScreen(), }; diff --git a/lib/screens/auth/change_password_screen.dart b/lib/screens/auth/change_password_screen.dart index 6e9d08d8..2c15cffa 100644 --- a/lib/screens/auth/change_password_screen.dart +++ b/lib/screens/auth/change_password_screen.dart @@ -2,24 +2,26 @@ import 'package:doctor_app_flutter/lookups/auth_lookup.dart'; import 'package:doctor_app_flutter/widgets/auth/auth_header.dart'; import 'package:flutter/material.dart'; import '../../widgets/auth/change_password.dart'; + class ChangePasswordScreen extends StatelessWidget { @override Widget build(BuildContext context) { // return Container()]; - + return Scaffold( - backgroundColor: Colors.white, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.changePassword), - ChangePassword(), - ], - ), + body: SafeArea( + child: ListView(children: [ + Container( + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.changePassword), + ChangePassword(), + ], ), - )); + ), + ]), + )); } } diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index ce0ce6ff..397d6745 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -11,12 +11,12 @@ import '../../widgets/auth/login_form.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + class Loginsreen extends StatefulWidget { @override _LoginsreenState createState() => _LoginsreenState(); } - class _LoginsreenState extends State { Future _prefs = SharedPreferences.getInstance(); @@ -25,7 +25,7 @@ class _LoginsreenState extends State { Future platformImeiFuture; Future getSharedPref() async { - sharedPref.getString('platformImei').then((imei){ + sharedPref.getString('platformImei').then((imei) { platformImei = imei; }); } @@ -42,45 +42,46 @@ class _LoginsreenState extends State { Widget build(BuildContext context) { getSharedPref(); return Scaffold( - backgroundColor: Colors.white, - body: SingleChildScrollView( - child: FutureBuilder( - future: platformImeiFuture, - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - return Text('Error: ${snapshot.error}'); - } else { - return Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), - alignment: Alignment.topLeft, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - (platformImei == null) - ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ + body: SafeArea( + child: ListView(children: [ + FutureBuilder( + future: platformImeiFuture, + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return DrAppCircularProgressIndeicator(); + default: + if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + return Container( + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), + alignment: Alignment.topLeft, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (platformImei == null) + ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ AuthHeader(loginType.knownUser), - LoginForm(), - ], - ) - : Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.unknownUser), - KnownUserLogin(), - ], - ), - ])); - } - } - }), + LoginForm(), + ], + ) + : Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.unknownUser), + KnownUserLogin(), + ], + ), + ])); + } + } + }), + ]), ), ); } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart new file mode 100644 index 00000000..f0e39210 --- /dev/null +++ b/lib/screens/auth/verification_methods_screen.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; + +import '../../lookups/auth_lookup.dart'; +import '../../widgets/auth/auth_header.dart'; +import '../../widgets/auth/verification_methods.dart'; + +/* + *@author: Elham Rababah + *@Date:4/7/2020 + *@param: + *@return: + *@desc: Verification Methods screen + */ +class VerificationMethodsScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + // return Container()]; + return Scaffold( + body: ListView(children: [ + Container( + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.verificationMethods), + VerificationMethods(), + ], + ), + ), + ])); + } +} diff --git a/lib/screens/auth/verify_account_screen.dart b/lib/screens/auth/verify_account_screen.dart index 77327292..752a5b7c 100644 --- a/lib/screens/auth/verify_account_screen.dart +++ b/lib/screens/auth/verify_account_screen.dart @@ -1,24 +1,27 @@ -import 'package:doctor_app_flutter/lookups/auth_lookup.dart'; -import 'package:doctor_app_flutter/widgets/auth/auth_header.dart'; import 'package:flutter/material.dart'; +import '../../lookups/auth_lookup.dart'; +import '../../widgets/auth/auth_header.dart'; +import '../../widgets/auth/verfiy_account.dart'; + class VerifyAccountScreen extends StatelessWidget { @override Widget build(BuildContext context) { // return Container()]; return Scaffold( - backgroundColor: Colors.white, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.verifyPassword), - // ChangePassword(), - ], - ), + body: SafeArea( + child: ListView(children: [ + Container( + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.verifyPassword), + VerifyAccount(), + ], ), - )); + ), + ]), + )); } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart new file mode 100644 index 00000000..180f50b8 --- /dev/null +++ b/lib/util/helpers.dart @@ -0,0 +1,59 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/* + *@author: Elham Rababah + *@Date:12/4/2020 + *@param: + *@return: + *@desc: This class will contian some Function will help developer + */ +class Helpers { +/* + *@author: Elham Rababah + *@Date:12/4/2020 + *@param: context, items, decKey, onSelectFun + *@return: Container Widget + *@desc: showCupertinoPicker its a general function to show cupertino picker + */ + showCupertinoPicker(context, items, decKey, onSelectFun) { + showModalBottomSheet( + context: context, + builder: (BuildContext builder) { + return Container( + height: SizeConfig.realScreenHeight * .3, + child: buildPickerItems(context, items, decKey, onSelectFun)); + }); + } + +/* + *@author: Elham Rababah + *@Date:12/4/2020 + *@param: context, List items, decKey, onSelectFun + *@return: Container widget + *@desc: buildPickerIterm this function will build the items of the cupertino + */ + buildPickerItems(context, List items, decKey, onSelectFun) { + return Container( + child: CupertinoPicker( + magnification: 1.5, + // backgroundColor: Colors.black87, + children: items.map((item) { + return Text( + '${item["$decKey"]}', + style: + TextStyle(color: Theme.of(context).primaryColor, fontSize: 20), + ); + }).toList(), + + itemExtent: 25, //height of each item + looping: true, + onSelectedItemChanged: (int index) { + // selectitem =index; + onSelectFun(index); + }, + ), + ); + } +} diff --git a/lib/widgets/auth/auth_header.dart b/lib/widgets/auth/auth_header.dart index 2f3876bd..ef507fd6 100644 --- a/lib/widgets/auth/auth_header.dart +++ b/lib/widgets/auth/auth_header.dart @@ -13,8 +13,8 @@ class AuthHeader extends StatelessWidget { var screen = Container( margin: SizeConfig.isMobile ? null - : EdgeInsetsDirectional.fromSTEB(SizeConfig.screenWidth * 0.30, - SizeConfig.screenWidth * 0.1, 0, 0), + : EdgeInsetsDirectional.fromSTEB(SizeConfig.realScreenWidth * 0.30, + SizeConfig.realScreenWidth * 0.1, 0, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -25,19 +25,13 @@ class AuthHeader extends StatelessWidget { margin: SizeConfig.isMobile ? EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0) : EdgeInsetsDirectional.fromSTEB( - SizeConfig.screenWidth * 0.13, 0, 0, 0), + SizeConfig.realScreenWidth * 0.13, 0, 0, 0), child: buildImageLogo(), ), SizedBox( height: 10, ), - Container( - margin: SizeConfig.isMobile - ? null - : EdgeInsetsDirectional.fromSTEB( - SizeConfig.screenWidth * 0.13, 0, 0, 0), - child: buildTextUnderLogo(context), - ) + buildTextUnderLogo(context), ], ), Column( @@ -74,70 +68,97 @@ class AuthHeader extends StatelessWidget { if (userType == loginType.unknownUser) { img = 'assets/images/welcome_login_icon.png'; } + if (userType == loginType.verifyPassword || + userType == loginType.verificationMethods) { + img = 'assets/images/verified_icon.png'; + } return Image.asset( img, fit: BoxFit.cover, - height: SizeConfig.isMobile ? null : SizeConfig.screenWidth * 0.09, + height: SizeConfig.isMobile ? null : SizeConfig.realScreenWidth * 0.09, ); } Widget buildTextUnderLogo(context) { + Widget finalWid; + double textFontSize = + SizeConfig.isMobile ? 30 : SizeConfig.textMultiplier * 3; + EdgeInsetsDirectional containerMargin; if (userType == loginType.knownUser || userType == loginType.unknownUser) { - return Text( + finalWid = Text( "LOGIN", - style: TextStyle( - fontSize: SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035, - fontWeight: FontWeight.w800), + style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), ); } else { String text1; String text2; if (userType == loginType.changePassword) { - text1 = 'Change'; + text1 = 'Change '; text2 = 'Password!'; } if (userType == loginType.verifyPassword) { - text1 = 'verify'; + text1 = 'Verify '; text2 = 'Your Account!'; } + if (userType == loginType.verificationMethods) { + text1 = 'Choose '; + text2 = 'Verification'; + } + List childrens = [ + Text( + text1, + style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), + ), + Text( + text2, + style: TextStyle( + color: Theme.of(context).primaryColor, + fontSize: textFontSize, + fontWeight: FontWeight.w800), + ) + ]; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - text1, - style: TextStyle( - fontSize: - SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035, - fontWeight: FontWeight.w800), - ), - Text( - text2, - style: TextStyle( - color: Theme.of(context).primaryColor, - fontSize: - SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035, - fontWeight: FontWeight.w800), - ) - ], - ); + if (!SizeConfig.isMobile) { + finalWid = Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: childrens, + ); + } else { + finalWid = Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: childrens, + ); + } } + if (!SizeConfig.isMobile) { + double start = SizeConfig.realScreenWidth * 0.13; + if (loginType.verifyPassword == userType || + loginType.changePassword == userType || + userType == loginType.verificationMethods) { + start = 0; + } + containerMargin = EdgeInsetsDirectional.fromSTEB(start, 0, 0, 0); + } + + return Container(margin: containerMargin, child: finalWid); } Container buildDrAppContainer(BuildContext context) { - if (userType == loginType.changePassword || userType == loginType.verifyPassword ) { + if (userType == loginType.changePassword || + userType == loginType.verifyPassword || + userType == loginType.verificationMethods) { return Container(); } return Container( margin: SizeConfig.isMobile ? null : EdgeInsetsDirectional.fromSTEB( - SizeConfig.screenWidth * 0.13, 0, 0, 0), + SizeConfig.realScreenWidth * 0.13, 0, 0, 0), child: Text( "Doctor App", style: TextStyle( - fontSize: SizeConfig.isMobile ? 26 : SizeConfig.screenWidth * 0.030, + fontSize: SizeConfig.isMobile ? 26 : SizeConfig.realScreenWidth * 0.030, fontWeight: FontWeight.w800, color: Theme.of(context).primaryColor), ), @@ -145,14 +166,16 @@ class AuthHeader extends StatelessWidget { } Text buildDrSulText(BuildContext context) { - if (userType == loginType.changePassword || userType == loginType.verifyPassword ) { + if (userType == loginType.changePassword || + userType == loginType.verifyPassword || + userType == loginType.verificationMethods) { return Text(''); } return Text( 'Dr Sulaiman Al Habib', style: TextStyle( fontWeight: FontWeight.w800, - fontSize: SizeConfig.isMobile ? 24 : SizeConfig.screenWidth * 0.029, + fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029, color: Theme.of(context).primaryColor, ), ); @@ -163,13 +186,15 @@ class AuthHeader extends StatelessWidget { if (userType == loginType.unknownUser) { text = 'Welcome Back to '; } - if (userType == loginType.changePassword || userType == loginType.verifyPassword ) { + if (userType == loginType.changePassword || + userType == loginType.verifyPassword || + userType == loginType.verificationMethods) { return Text(''); } return Text( text, style: TextStyle( - fontSize: SizeConfig.isMobile ? 24 : SizeConfig.screenWidth * 0.029), + fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029), ); } } diff --git a/lib/widgets/auth/change_password.dart b/lib/widgets/auth/change_password.dart index 5c231f6a..020c0472 100644 --- a/lib/widgets/auth/change_password.dart +++ b/lib/widgets/auth/change_password.dart @@ -15,7 +15,7 @@ class ChangePassword extends StatelessWidget { return Form( key: changePassFormKey, child: Container( - width: SizeConfig.widthMultiplier * 90, + width: SizeConfig.realScreenWidth * 0.90, child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: < Widget>[ diff --git a/lib/widgets/auth/known_user_login.dart b/lib/widgets/auth/known_user_login.dart index b39b9c1b..48eb0104 100644 --- a/lib/widgets/auth/known_user_login.dart +++ b/lib/widgets/auth/known_user_login.dart @@ -128,14 +128,16 @@ class _KnownUserLoginState extends State { ['MemberName'], style: TextStyle( color: Hexcolor('515A5D'), - fontSize: 2.5 *SizeConfig.textMultiplier, + fontSize: + 2.5 * SizeConfig.textMultiplier, fontWeight: FontWeight.w800), ), Text( 'ENT Spec', style: TextStyle( color: Hexcolor('515A5D'), - fontSize: 1.5 *SizeConfig.textMultiplier), + fontSize: + 1.5 * SizeConfig.textMultiplier), ) ], ), @@ -193,7 +195,7 @@ class _KnownUserLoginState extends State { // textAlign: TextAlign.center, style: TextStyle( color: Colors.white, - fontSize: 2.5 *SizeConfig.textMultiplier), + fontSize: 2.5 * SizeConfig.textMultiplier), ), ), ), @@ -219,7 +221,7 @@ class _KnownUserLoginState extends State { "More verification Options".toUpperCase(), style: TextStyle( color: Theme.of(context).primaryColor, - fontSize: 2.5 *SizeConfig.textMultiplier), + fontSize: 2.5 * SizeConfig.textMultiplier), )), ), SizedBox( @@ -231,7 +233,7 @@ class _KnownUserLoginState extends State { } navigateToMoreOption() { - Navigator.of(context).pushNamed('routeName'); + Navigator.of(context).pushNamed(VERIFICATION_METHODS); } _authenticate() { diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index de2bfdec..85cf892f 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -15,7 +17,7 @@ import '../../util/dr_app_toast_msg.dart'; DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); DrAppToastMsg toastMsg = DrAppToastMsg(); - +Helpers helpers = Helpers(); class LoginForm extends StatefulWidget with DrAppToastMsg { LoginForm({ Key key, @@ -27,6 +29,7 @@ class LoginForm extends StatefulWidget with DrAppToastMsg { class _LoginFormState extends State { final loginFormKey = GlobalKey(); + var projectIdController = TextEditingController(); String _platformImei = 'Unknown'; String uniqueId = "Unknown"; var projectsList = []; @@ -57,13 +60,14 @@ class _LoginFormState extends State { return Form( key: loginFormKey, child: Container( - width: SizeConfig.widthMultiplier * 90, + width: SizeConfig.realScreenWidth * 0.90, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ buildSizedBox(), TextFormField( keyboardType: TextInputType.number, + // style: TextStyle(fontSize: 30), decoration: InputDecoration( prefixIcon: Image.asset('assets/images/user_id_icon.png'), hintText: 'Enter ID', @@ -118,14 +122,17 @@ class _LoginFormState extends State { userInfo.Password = value; }), buildSizedBox(), - DropdownButtonFormField( - value: userInfo.ProjectID, - isExpanded: false, + TextFormField( + controller: projectIdController, + onTap: () { + helpers.showCupertinoPicker( + context,projectsList, 'Desciption', onSelectProject); + }, + showCursor: false, + readOnly: true, decoration: InputDecoration( - contentPadding: EdgeInsets.all(10), - isDense: true, - prefixIcon: Image.asset('assets/images/hospital_icon.png'), - // hintText: 'Enter Password', + prefixIcon: Image.asset('assets/images/password_icon.png'), + hintText: 'Select your porject', hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), enabledBorder: OutlineInputBorder( @@ -140,25 +147,13 @@ class _LoginFormState extends State { //BorderRadius.all(Radius.circular(20)); ), validator: (value) { - print(value); - if (value == null) { - return 'Please select your project'; + if (value.isEmpty) { + return 'Please enter your porject'; } return null; }, - items: projectsList.map((item) { - return DropdownMenuItem( - child: Text( - '${item['Desciption']}', - ), - value: item['ID'], - ); - }).toList(), - onChanged: (value) { - print(value); - setState(() { - userInfo.ProjectID = value; - }); + onSaved: (value) { + userInfo.Password = value; }), buildSizedBox(), Row( @@ -180,7 +175,9 @@ class _LoginFormState extends State { ), RaisedButton( onPressed: () { - login(context, authProv); + Navigator.of(context).pushNamed(VERIFICATION_METHODS); + + // login(context, authProv); }, textColor: Colors.white, elevation: 0.0, @@ -191,7 +188,7 @@ class _LoginFormState extends State { child: Container( padding: const EdgeInsets.all(10.0), height: 50, - width: SizeConfig.widthMultiplier * 30, + width: SizeConfig.realScreenWidth * 0.30, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -259,7 +256,7 @@ class _LoginFormState extends State { if (res['MessageStatus'] == 1) { setSharedPref('platformImei', _platformImei); saveObjToString('loggedUser', preRes); - Navigator.of(context).pushNamed(HOME); + Navigator.of(context).pushNamed(VERIFICATION_METHODS); // save imei on shared preferance } else { // handel error @@ -331,4 +328,12 @@ class _LoginFormState extends State { saveObjToString(String key, value) async { sharedPref.setObj(key, value); } + + onSelectProject(index) { + setState(() { + userInfo.ProjectID = projectsList[index]["ID"]; + projectIdController.text = projectsList[index]['Desciption']; + }); + } + } diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart new file mode 100644 index 00000000..2ac31a0e --- /dev/null +++ b/lib/widgets/auth/verfiy_account.dart @@ -0,0 +1,169 @@ +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../config/size_config.dart'; +import '../../routes.dart'; + +class VerifyAccount extends StatelessWidget { + final verifyAccountForm = GlobalKey(); + @override + Widget build(BuildContext context) { + return Form( + key: verifyAccountForm, + child: Container( + width: SizeConfig.realScreenWidth * 0.90, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildSizedBox(30), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + width:SizeConfig.realScreenWidth*0.20, + child: TextFormField( + decoration: 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), + )), + onChanged: (_) {}, + )), + Container( + width:SizeConfig.realScreenWidth*0.20, + child: TextFormField( + decoration: 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), + )), + onChanged: (_) {}, + )), + Container( + width:SizeConfig.realScreenWidth*0.20, + child: TextFormField( + decoration: 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), + )), + onChanged: (_) {}, + )), + Container( + width:SizeConfig.realScreenWidth*0.20, + child: TextFormField( + decoration: 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), + )), + onChanged: (_) {}, + )) + ], + ), + // buildSizedBox(40), + buildSizedBox(20), + buildText(), + // buildSizedBox(10.0), + // Text() + + buildSizedBox(40), + + // buildSizedBox(), + RaisedButton( + onPressed: () { + Navigator.of(context).pushNamed(HOME); + }, + elevation: 0.0, + child: Container( + width: double.infinity, + height: 50, + child: Center( + child: Text( + 'Verfiy'.toUpperCase(), + // textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 3 * SizeConfig.textMultiplier), + ), + ), + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + 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() { + var text = RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 3.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan(text: 'You will receive a '), + new TextSpan( + text: 'Login Code ', + style: TextStyle(fontWeight: FontWeight.w700)), + new TextSpan(text: 'By SMS, Please enter the code') + ])); + return text; + } + + SizedBox buildSizedBox([double height = 20]) { + return SizedBox( + height: height, + ); + } +} diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart new file mode 100644 index 00000000..40bb77ba --- /dev/null +++ b/lib/widgets/auth/verification_methods.dart @@ -0,0 +1,126 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/routes.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +/* + *@author: Elham Rababah + *@Date:4/7/2020 + *@param: + *@return: + *@desc: Verification Methods widget + */ +class VerificationMethods extends StatelessWidget { + MainAxisAlignment spaceBetweenMethods =MainAxisAlignment.spaceBetween; + + @override + Widget build(BuildContext context) { + // if(!SizeConfig.isMobile) { + // spaceBetweenMethods = MainAxisAlignment.spaceAround; + // } + return Container( + width: SizeConfig.realScreenWidth * 0.90, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Please choose one of the Following option to verify", + style: TextStyle( + fontSize: 3.5 * SizeConfig.textMultiplier, + ), + ), + SizedBox( + height: 40, + ), + Container( + width: SizeConfig.realScreenWidth * 80, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: spaceBetweenMethods, + children: [ + buildVerificationMethod(context, + 'assets/images/verification_fingerprint_icon.png', + 'Fingerprint', + () {}), + buildVerificationMethod(context, + 'assets/images/verification_faceid_icon.png', + 'Face ID', + () {}), + ], + ), + SizedBox( + height: 40, + ), + Row( + mainAxisAlignment: spaceBetweenMethods, + children: [ + buildVerificationMethod(context, + 'assets/images/verification_whatsapp_icon.png', + 'WhatsApp', + () {}), + buildVerificationMethod(context, + 'assets/images/verification_sms_icon.png', + 'SMS', + () {}), + ], + ) + ], + ), + ), + SizedBox( + height: SizeConfig.heightMultiplier * 2, + ) + ], + ), + ); + } + +/* + *@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( + onTap: (){ + Navigator.of(context).pushNamed(VERIFY_ACCOUNT); + + }, + child: Container( + // height: SizeConfig.heightMultiplier *2, + height: SizeConfig.heightMultiplier * 19, + width: SizeConfig.widthMultiplier * 37, + + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 1, + color: Hexcolor( + '#CCCCCC') // <--- border width here + ), + borderRadius: BorderRadius.all(Radius.circular(10))), + child: Column( + children: [ + Container( + margin: EdgeInsetsDirectional.only( + top: SizeConfig.heightMultiplier * 0.5), + child: Image.asset( + url, + height: SizeConfig.heightMultiplier * 10, + fit: BoxFit.cover, + ), + ), + SizedBox( + height: 10, + ), + Text(dec, style: TextStyle(fontSize:SizeConfig.textMultiplier*2 ),) + ], + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 4c0717c5..b5106a1b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.39.4" + version: "0.39.5" archive: dependency: transitive description: @@ -84,7 +84,7 @@ packages: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.3.3" + version: "1.3.4" build_runner: dependency: "direct dev" description: @@ -182,7 +182,7 @@ packages: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.3" + version: "1.3.4" fixnum: dependency: transitive description: @@ -316,7 +316,7 @@ packages: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "0.3.4" js: dependency: transitive description: @@ -387,13 +387,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.3" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.10" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c0c6e878..7b87b081 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,8 +69,13 @@ flutter: - assets/images/verification_faceid_lg_icon.png - assets/images/verification_sms_lg_icon.png - assets/images/verification_whatsapp_lg_icon.png + - assets/images/verification_fingerprint_icon.png + - assets/images/verification_faceid_icon.png + - assets/images/verification_sms_icon.png + - assets/images/verification_whatsapp_icon.png - assets/images/close_icon.png - assets/images/welcome_login_icon.png + - assets/images/verified_icon.png # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see