diff --git a/lib/core/model/rate/appointment_details.dart b/lib/core/model/rate/appointment_details.dart index 30280b4a..77d759db 100644 --- a/lib/core/model/rate/appointment_details.dart +++ b/lib/core/model/rate/appointment_details.dart @@ -5,13 +5,13 @@ class AppointmentDetails { int appointmentNo; int clinicID; int doctorID; - String startTime; - String endTime; - String appointmentDate; - String clinicName; - String doctorImageURL; - String doctorName; - String projectName; + dynamic startTime; + dynamic endTime; + dynamic appointmentDate; + dynamic clinicName; + dynamic doctorImageURL; + dynamic doctorName; + dynamic projectName; AppointmentDetails( {this.setupID, diff --git a/lib/main.dart b/lib/main.dart index 7438de94..bd310dbc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -52,6 +52,7 @@ class MyApp extends StatelessWidget { TranslationBaseDelegate(), GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, ], supportedLocales: [ const Locale('ar', ''), // Arabic diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 2b9e698b..05919209 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/family/my-family.dart'; @@ -317,7 +318,7 @@ class _AllHabibMedicalServiceState extends State { onTap: () => Navigator.push( context, FadePage( - page: ParkingPage(), + page: FindUsPage(), ), ), imageLocation: 'assets/images/new-design/find_us_icon.png', diff --git a/lib/pages/family/add-family-member.dart b/lib/pages/family/add-family-member.dart index f1742141..98df5f88 100644 --- a/lib/pages/family/add-family-member.dart +++ b/lib/pages/family/add-family-member.dart @@ -179,8 +179,7 @@ class _AddMember extends State { request.regionID = 1; } loading(true); - this - .familyFileProvider + familyFileProvider .insertNewMember(request) .then((value) => sendActivationCode(value)); } @@ -189,8 +188,7 @@ class _AddMember extends State { // var request = this.getCommonRequest(); loading(true); patientShareRequestID = result['PatientShareRequestID']; - this - .familyFileProvider + familyFileProvider .sendActivationCode(mobileNo, countryCode, nationalIDorFile.text) .then((result) => { if (result != null && result['isSMSSent'] == true) @@ -203,11 +201,13 @@ class _AddMember extends State { startSMSService(type, result) { loading(false); - new SMSOTP( + SMSOTP( context, type, - this.mobileNo, - (value) => {this.checkActivationCode(value, result)}, + mobileNo, + (value) { + this.checkActivationCode(value, result); + }, () => { print('Faild..'), }, @@ -215,8 +215,7 @@ class _AddMember extends State { } checkActivationCode(value, result) { - this - .familyFileProvider + familyFileProvider .checkActivationCode( result['LogInTokenID'], value, nationalIDorFile.text, mobileNo) .then((result) => { @@ -226,8 +225,7 @@ class _AddMember extends State { } handleFamilyRequests(id, stauts) { - this - .familyFileProvider + familyFileProvider .acceptAndRejectRecievedRequests(id, stauts) .then((result) => { sharedPref.remove(FAMILY_FILE), diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 6483b6b2..55100497 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -19,7 +19,7 @@ class InsuranceCard extends StatefulWidget { @override _InsuranceCardState createState() => _InsuranceCardState(); } - +//TODO fix it class _InsuranceCardState extends State { @override Widget build(BuildContext context) { @@ -29,6 +29,7 @@ class _InsuranceCardState extends State { AppScaffold( isShowAppBar: true, baseViewModel: model, + image: 'assets/images/medical/insurance_card_icon.png', appBarTitle: TranslationBase.of(context).insuranceCards, body: Container( margin: EdgeInsets.only( diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 940db01c..c06dd473 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; @@ -72,173 +73,165 @@ class _ConfirmLogin extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).confirm, - isShowAppBar: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(20), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column( - children: [ - Expanded( - flex: 3, - child: user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/dq_logo_icon.png', - height: 90, - width: 90, - ), - AppText( - TranslationBase.of(context).welcomeBack + - ' ' + - user.name, - fontSize: SizeConfig.textMultiplier * 3.5, - ), - AppText( - TranslationBase.of(context).accountInfo, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - Card( - color: Colors.grey[300], - child: Row( - children: [ - Expanded( - child: ListTile( - title: Text( - TranslationBase.of(context) - .lastLoginAt, - textAlign: TextAlign.center, - ), - subtitle: Text( - user.editedOn != null - ? formatDate(DateUtil - .convertStringToDate( - user.editedOn)) - : '--', - textAlign: TextAlign.center), - )), - Expanded( - child: ListTile( - title: Text( - TranslationBase.of(context) - .lastLoginWith, - textAlign: TextAlign.center), - subtitle: Text( - getType( - user.logInType, context), - textAlign: TextAlign.center), - )) - ], - )) - ], - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/dq_logo_icon.png', - height: 90, - width: 90, + appBarTitle: TranslationBase.of(context).confirm, + isShowAppBar: true, + isShowDecPage: false, + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(20), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column( + children: [ + Expanded( + flex: 3, + child: user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + 'assets/images/DQ/dq_logo_icon.png', + height: 90, + width: 90, + ), + AppText( + TranslationBase.of(context).welcomeBack + + ' ' + + user.name, + fontSize: SizeConfig.textMultiplier * 3.5, + ), + AppText( + TranslationBase.of(context).accountInfo, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + Card( + color: Colors.grey[300], + child: Row( + children: [ + Expanded( + child: ListTile( + title: Text( + TranslationBase.of(context).lastLoginAt, + textAlign: TextAlign.center, + ), + subtitle: Text( + user.editedOn != null + ? formatDate( + DateUtil.convertStringToDate( + user.editedOn)) + : '--', + textAlign: TextAlign.center), + )), + Expanded( + child: ListTile( + title: Text( + TranslationBase.of(context) + .lastLoginWith, + textAlign: TextAlign.center), + subtitle: Text( + getType(user.logInType, context), + textAlign: TextAlign.center), + )) + ], + )) + ], + ) + : Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + 'assets/images/DQ/dq_logo_icon.png', + height: 90, + width: 90, + ), + this.onlySMSBox == false + ? AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.left, + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.start, ), - this.onlySMSBox == false - ? AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: - SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: - SizeConfig.textMultiplier * 2.5, - textAlign: TextAlign.start, - ), - ])), - user != null && isMoreOption == false - ? Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => { - authenticateUser( - 3, - BiometricType - .face.index) - }, - child: - getButton(user.logInType))), - Expanded(child: getButton(5)) - ]) - ])) - : Expanded( - flex: 4, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + ])), + user != null && isMoreOption == false + ? Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded(child: getButton(3)), - Expanded(child: getButton(2)) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: getButton(1)), - Expanded(child: getButton(4)) - ], - ), - ]), - ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, + Expanded( + child: InkWell( + onTap: () => { + authenticateUser( + 3, BiometricType.face.index) + }, + child: getButton(user.logInType))), + Expanded(child: getButton(5)) + ]) + ])) + : Expanded( + flex: 4, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - user != null + onlySMSBox == false ? Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context) - .useAnotherAccount, - () => { - Navigator.of(context).pushNamed( - LOGIN_TYPE, - ) - }, - )), + Expanded(child: getButton(3)), + Expanded(child: getButton(2)) ], ) : SizedBox(), - ], - )) + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded(child: getButton(1)), + Expanded(child: getButton(4)) + ], + ), + ]), + ), + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + user != null + ? Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).useAnotherAccount, + () => { + Navigator.of(context).pushNamed( + LOGIN_TYPE, + ) + }, + )), + ], + ) + : SizedBox(), ], - )))); + ), + ) + ], + ), + ), + ), + ); } Future _getAvailableBiometrics() async { @@ -300,6 +293,7 @@ class _ConfirmLogin extends State { showLoader(true); var req = getCommonRequest(); var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); + GifLoaderDialogUtils.showMyDialog(context); sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); authService @@ -321,18 +315,23 @@ class _ConfirmLogin extends State { }) .catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + GifLoaderDialogUtils.hideDialog(context); + + }); } sendActivationCode(type) async { var request = this.getCommonRequest(); // loading(true); - - await this.authService.sendActivationCode(request).then((result) => { - if (result != null && result['isSMSSent'] == true) - {this.startSMSService(type), print(result)} - }); + GifLoaderDialogUtils.showMyDialog(context); + await this.authService.sendActivationCode(request).then((result) { + GifLoaderDialogUtils.hideDialog(context); + if (result != null && result['isSMSSent'] == true) { + this.startSMSService(type); + } + }).catchError((r) { + GifLoaderDialogUtils.hideDialog(context); + }); // SMSOTP.showLoadingDialog(context, false), } @@ -479,11 +478,10 @@ class _ConfirmLogin extends State { } checkActivationCode({value}) async { - SMSOTP.showLoadingDialog(context, true); + GifLoaderDialogUtils.showMyDialog(context); var request = this.getCommonRequest().toJson(); - this - .authService + authService .checkActivationCode(request, value) .then((result) => { if (result is Map) @@ -498,25 +496,20 @@ class _ConfirmLogin extends State { } else { - this.userData = result - .list, //AuthenticatedUser.fromJson(result['List'][0]), - this.sharedPref.setObject(USER_PROFILE, result.list), - this.loginTokenID = result.logInTokenID, - this - .sharedPref - .setObject(LOGIN_TOKEN_ID, result.logInTokenID), - this - .sharedPref - .setString(TOKEN, result.authenticationTokenID), - this.checkIfUserAgreedBefore(result), - // Navigator.of(context).pop(), - SMSOTP.showLoadingDialog(context, false), + userData = result.list, + //AuthenticatedUser.fromJson(result['List'][0]), + sharedPref.setObject(USER_PROFILE, result.list), + loginTokenID = result.logInTokenID, + sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + sharedPref.setString(TOKEN, result.authenticationTokenID), + checkIfUserAgreedBefore(result), + } } else { // Navigator.of(context).pop(), - SMSOTP.showLoadingDialog(context, false), + GifLoaderDialogUtils.hideDialog(context), Future.delayed(Duration(seconds: 1), () { AppToast.showErrorToast(message: result); }), @@ -524,8 +517,8 @@ class _ConfirmLogin extends State { }) .catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + GifLoaderDialogUtils.hideDialog(context); + }); } checkIfUserAgreedBefore(CheckActivationCode result) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 9e9ae12c..91d356de 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -11,7 +11,6 @@ import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doct import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -19,10 +18,12 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class Login extends StatefulWidget { @override @@ -60,72 +61,76 @@ class _Login extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).login, - isShowAppBar: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( + appBarTitle: TranslationBase.of(context).login, + isShowAppBar: true, + isShowDecPage: false, + body: SingleChildScrollView( + child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), height: SizeConfig.realScreenHeight * .9, width: SizeConfig.realScreenWidth, - child: Column(children: [ - Expanded( - flex: 2, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.start, - )), - Expanded( - flex: 3, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - MobileNo( - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value), - Container( - child: TextFields( - fontWeight: FontWeight.normal, - controller: nationalIDorFile, - onChanged: (value) => {validateForm()}, - prefixIcon: Icon( - loginType == 1 - ? Icons.chrome_reader_mode - : Icons.receipt, - color: Color(0xFF40ACC9)), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: loginType == 1 - ? TranslationBase.of(context).nationalID - : TranslationBase.of(context).fileNo, - )) - ], - ), - ), - Expanded( + child: Column( + children: [ + Expanded( + flex: 2, + child: AppText( + TranslationBase.of(context).enterNationalId, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.start, + )), + Expanded( flex: 3, child: Column( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).login, - () => {this.startLogin()}, - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[900], - textColor: Colors.white, - )) - ], - ), + MobileNo( + onNumberChange: (value) => + {mobileNo = value, validateForm()}, + onCountryChange: (value) => countryCode = value), + Container( + child: TextFields( + fontWeight: FontWeight.normal, + controller: nationalIDorFile, + onChanged: (value) => {validateForm()}, + prefixIcon: Icon( + loginType == 1 + ? Icons.chrome_reader_mode + : Icons.receipt, + color: Color(0xFF40ACC9)), + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + hintText: loginType == 1 + ? TranslationBase.of(context).nationalID + : TranslationBase.of(context).fileNo, + )) ], - )) - ]), - ))); + ), + ), + Expanded( + flex: 3, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).login, + () => {this.startLogin()}, + color: isButtonDisabled == true + ? Colors.grey + : Colors.grey[900], + textColor: Colors.white, + )) + ], + ), + ], + )) + ], + ), + ), + ), + ); } startLogin() { @@ -136,8 +141,10 @@ class _Login extends State { void validateForm() { //TODO fix login - if (util.validateIDBox(nationalIDorFile.text, loginType) == true && - mobileNo.length >= 9 && + if (util.validateIDBox(nationalIDorFile.text, loginType) == + true /*&& + mobileNo.length >= 9 */ + && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; @@ -151,7 +158,6 @@ class _Login extends State { checkUserAuthentication() { // showLoader(true); - GifLoaderDialogUtils.showMyDialog(context); var request = CheckPatientAuthenticationReq(); request.isRegister = false; request.patientMobileNumber = int.parse(mobileNo); @@ -166,15 +172,16 @@ class _Login extends State { request.patientID = int.parse(nationalIDorFile.text); } sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); + GifLoaderDialogUtils.showMyDialog(context); authService .checkPatientAuthentication(request) .then((value) => { //showLoader(false), - GifLoaderDialogUtils.hideDialog(context), if (value['isSMSSent']) { sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), + GifLoaderDialogUtils.hideDialog(context), Navigator.of(context).pushNamed(CONFIRM_LOGIN) } else @@ -183,10 +190,10 @@ class _Login extends State { } }) .catchError((err) { - GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: err); + GifLoaderDialogUtils.hideDialog(context); }); + // SMSOTP.showLoadingDialog(context, false), } checkActivationCode({code}) async { @@ -207,7 +214,6 @@ class _Login extends State { request['PatientIdentificationID'] = ''; request['PatientID'] = int.parse(nationalIDorFile.text); } - GifLoaderDialogUtils.showMyDialog(context); // request.isRegister = false; this.authService.checkActivationCode(request, code).then((result) => { result = CheckActivationCode.fromJson(result), @@ -215,15 +221,11 @@ class _Login extends State { this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), - GifLoaderDialogUtils.hideDialog(context), - //this.checkIfUserAgreedBefore(result), - Navigator.of(context).pushNamed( - HOME, - ), - //showLoader(false), + appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { + GifLoaderDialogUtils.hideDialog(context), if (appointmentRateViewModel.isHaveAppointmentNotRate) { Navigator.pushReplacement( @@ -244,10 +246,10 @@ class _Login extends State { } }) .catchError((err) { - GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: err); - }) + GifLoaderDialogUtils.hideDialog(context); + }), + // SMSOTP.showLoadingDialog(context, false), }); } diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index f5a06df9..b80ce22e 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -172,7 +172,7 @@ class FamilyFilesProvider with ChangeNotifier { throw error; } } - + //TODO Future checkActivationCode( loginTokenID, activationCode, indentification, mobileNo) async { try { diff --git a/lib/widgets/Loader/gif_loader_container.dart b/lib/widgets/Loader/gif_loader_container.dart index 2d3d1cdb..06c151c9 100644 --- a/lib/widgets/Loader/gif_loader_container.dart +++ b/lib/widgets/Loader/gif_loader_container.dart @@ -16,7 +16,7 @@ class _GifLoaderContainerState extends State WidgetsBinding.instance.addPostFrameCallback((_) { controller1.repeat( - min: 0, max: 12, period: Duration(milliseconds: 750), reverse: true); + min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); }); super.initState(); } diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 7cfba5e6..6e740fc8 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -243,7 +243,7 @@ class _TextFieldsState extends State { onSaved: widget.onSaved, style: Theme.of(context) .textTheme - .body2 + .bodyText1 .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 15727972..5eb76c9f 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -35,6 +36,7 @@ class AppScaffold extends StatelessWidget { final Widget floatingActionButton; final String title; final String description; + final String image; final bool isShowDecPage; AuthenticatedUserObject authenticatedUserObject = @@ -52,7 +54,7 @@ class AppScaffold extends StatelessWidget { this.title, this.description, this.isShowDecPage = true, - this.isBottomBar}); + this.isBottomBar, this.image}); @override Widget build(BuildContext context) { @@ -71,14 +73,24 @@ class AppScaffold extends StatelessWidget { title: Texts(authenticatedUserObject.isLogin || !isShowDecPage ? appBarTitle.toUpperCase() : TranslationBase.of(context).serviceInformationTitle,color: Colors.white,bold: true,), - leading: Builder( + leading:Builder( builder: (BuildContext context) { return ArrowBack(); }, ), centerTitle: true, actions: [ - IconButton( + image!=null? InkWell( + onTap: ()=> Navigator.pop(context), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + image, + height: SizeConfig.heightMultiplier * 5, + width: SizeConfig.heightMultiplier * 5, + color: Colors.white, + ), + ),): IconButton( icon: Icon(FontAwesomeIcons.home), color: Colors.white, onPressed: () { diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 1a67ae8f..8400cca3 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -29,6 +29,13 @@ class SMSOTP { this.onFailure, ); + final verifyAccountForm = GlobalKey(); + + TextEditingController digit1 = TextEditingController(text: ""); + TextEditingController digit2 = TextEditingController(text: ""); + TextEditingController digit3 = TextEditingController(text: ""); + TextEditingController digit4 = TextEditingController(text: ""); + Map verifyAccountFormValue = { 'digit1': '', 'digit2': '', @@ -42,6 +49,7 @@ class SMSOTP { String errorMsg; String displayTime = ''; + displayDialog(BuildContext context) async { return showDialog( context: context, @@ -83,65 +91,47 @@ class SMSOTP { .substring(mobileNo.toString().length - 3), textAlign: TextAlign.center, )), - Padding( - padding: EdgeInsets.only(top: 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - width: SizeConfig.realScreenWidth * 0.15, - child: TextFormField( - textInputAction: TextInputAction.next, - style: buildTextStyle(), - autofocus: true, - maxLength: 1, - textAlign: TextAlign.center, - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - validator: validateCodeDigit, - onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(focusD2); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context).requestFocus(focusD2); - verifyAccountFormValue['digit1'] = val.trim(); - checkValue(); - } - }, - ), - ), - Container( - width: SizeConfig.realScreenWidth * 0.15, - child: TextFormField( - focusNode: focusD2, + Form( + key: verifyAccountForm, + child: Padding( + padding: EdgeInsets.only(top: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + width: SizeConfig.realScreenWidth * 0.15, + child: TextFormField( textInputAction: TextInputAction.next, + style: buildTextStyle(), + autofocus: true, maxLength: 1, + controller: digit1, textAlign: TextAlign.center, - style: buildTextStyle(), keyboardType: TextInputType.number, decoration: buildInputDecoration(context), onSaved: (val) {}, + validator: validateCodeDigit, onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(focusD3); + FocusScope.of(context).requestFocus(focusD2); }, onChanged: (val) { if (val.length == 1) { FocusScope.of(context) - .requestFocus(focusD3); - verifyAccountFormValue['digit2'] = val.trim(); + .requestFocus(focusD2); + verifyAccountFormValue['digit1'] = + val.trim(); checkValue(); } }, - validator: validateCodeDigit), - ), - Container( + ), + ), + Container( width: SizeConfig.realScreenWidth * 0.15, child: TextFormField( - focusNode: focusD3, + focusNode: focusD2, textInputAction: TextInputAction.next, maxLength: 1, + controller: digit2, textAlign: TextAlign.center, style: buildTextStyle(), keyboardType: TextInputType.number, @@ -149,38 +139,69 @@ class SMSOTP { onSaved: (val) {}, onFieldSubmitted: (_) { FocusScope.of(context) - .requestFocus(focusD4); + .requestFocus(focusD3); }, onChanged: (val) { if (val.length == 1) { FocusScope.of(context) - .requestFocus(focusD4); - verifyAccountFormValue['digit3'] = val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit)), - Container( - width: SizeConfig.realScreenWidth * 0.15, - child: TextFormField( - focusNode: focusD4, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - verifyAccountFormValue['digit4'] = val.trim(); + .requestFocus(focusD3); + verifyAccountFormValue['digit2'] = + val.trim(); checkValue(); } }, - validator: validateCodeDigit)), - ], + validator: validateCodeDigit), + ), + Container( + width: SizeConfig.realScreenWidth * 0.15, + child: TextFormField( + focusNode: focusD3, + textInputAction: TextInputAction.next, + maxLength: 1, + controller: digit3, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + verifyAccountFormValue['digit3'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + Container( + width: SizeConfig.realScreenWidth * 0.15, + child: TextFormField( + focusNode: focusD4, + maxLength: 1, + textAlign: TextAlign.center, + style: buildTextStyle(), + controller: digit4, + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + verifyAccountFormValue['digit4'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + ], + ), ), ), Padding( @@ -231,7 +252,7 @@ class SMSOTP { String validateCodeDigit(value) { if (value.isEmpty) { - return 'Please enter your Password'; + return ' '; } else if (value.length == 3) { print(value); } else { @@ -241,15 +262,10 @@ class SMSOTP { checkValue() { //print(verifyAccountFormValue); - if (verifyAccountFormValue['digit1'] != ''&& - verifyAccountFormValue['digit2'] != '' && - verifyAccountFormValue['digit3'] != '' && - verifyAccountFormValue['digit4'] != '') { - onSuccess(verifyAccountFormValue['digit1'] + - verifyAccountFormValue['digit2'] + - verifyAccountFormValue['digit3'] + - verifyAccountFormValue['digit4']); + if (verifyAccountForm.currentState.validate()) { + onSuccess(digit1.text.toString()+digit2.text.toString()+digit3.text.toString()+digit4.text.toString()); } + } getSecondsAsDigitalClock(int inputSeconds) {