From b15ddd17132c2eefdbc4ca65dad38bffab25b48e Mon Sep 17 00:00:00 2001 From: faizatflutter Date: Thu, 4 Sep 2025 17:21:06 +0300 Subject: [PATCH] completed till otp receiving --- lib/core/app_state.dart | 2 ++ .../authentication_view_model.dart | 3 +- lib/presentation/authentication/register.dart | 10 ++++-- .../authentication/register_step2.dart | 7 ++-- lib/widgets/input_widget.dart | 6 ++-- pubspec.yaml | 32 +++++++++---------- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart index 8f1cbff..a709799 100644 --- a/lib/core/app_state.dart +++ b/lib/core/app_state.dart @@ -20,6 +20,8 @@ class AppState { int getLanguageID() => EasyLocalization.of(navigationService.navigatorKey.currentContext!)?.locale.languageCode == "ar" ? 1 : 2; + String? getLanguageCode() => EasyLocalization.of(navigationService.navigatorKey.currentContext!)?.locale.languageCode; + AuthenticatedUser? _authenticatedUser; void setAuthenticatedUser(AuthenticatedUser authenticatedUser) { diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 28d10ed..e856d3e 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'dart:developer'; import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; @@ -14,6 +13,7 @@ import 'package:hmg_patient_app_new/features/authentication/authentication_repo. import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; +import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; @@ -45,6 +45,7 @@ class AuthenticationViewModel extends ChangeNotifier { GenderTypeEnum? genderType; bool isTermsAccepted = false; List? countriesList; + NationalityCountries? pickedCountryByUAEUser; bool isDubai = false; diff --git a/lib/presentation/authentication/register.dart b/lib/presentation/authentication/register.dart index 6e7e178..e51792c 100644 --- a/lib/presentation/authentication/register.dart +++ b/lib/presentation/authentication/register.dart @@ -10,6 +10,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; +import 'package:hmg_patient_app_new/features/authentication/widgets/otp_verification_screen.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart'; @@ -17,7 +18,6 @@ import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dar import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart' show CustomButton; import 'package:hmg_patient_app_new/widgets/dropdown/country_dropdown_widget.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; -import 'package:hmg_patient_app_new/widgets/otp/otp.dart'; import 'package:provider/provider.dart'; class RegisterNew extends StatefulWidget { @@ -223,7 +223,13 @@ class _RegisterNew extends State { child: CustomButton( text: LocaleKeys.sendOTPSMS.tr(), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OTPVerificationPage(phoneNumber: '12234567'))); + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => OTPVerificationScreen( + phoneNumber: '504278212', + checkActivationCode: (int code) {}, + onResendOTPPressed: (String phone) {}, + ), + )); // if (mobileNo.isEmpty) { // context.showBottomSheet( diff --git a/lib/presentation/authentication/register_step2.dart b/lib/presentation/authentication/register_step2.dart index 28d7725..151a4c8 100644 --- a/lib/presentation/authentication/register_step2.dart +++ b/lib/presentation/authentication/register_step2.dart @@ -1,4 +1,3 @@ - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -175,7 +174,11 @@ class _RegisterNew extends State { ? Selector? countriesList, NationalityCountries? selectedCountry, bool isArabic})>( selector: (context, authViewModel) { final appState = getIt.get(); - return (countriesList: authViewModel.countriesList, selectedCountry: authViewModel.pickedCountryByUAEUser, isArabic: appState.isArabic()); + return ( + countriesList: authViewModel.countriesList, + selectedCountry: authViewModel.pickedCountryByUAEUser, + isArabic: appState.isArabic(), + ); }, shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic, builder: (context, data, child) { diff --git a/lib/widgets/input_widget.dart b/lib/widgets/input_widget.dart index 0f520c6..53a0130 100644 --- a/lib/widgets/input_widget.dart +++ b/lib/widgets/input_widget.dart @@ -34,13 +34,13 @@ class TextInputWidget extends StatelessWidget { final bool hasError; final String? errorMessage; Function(CountryEnum)? onCountryChange; - SelectionTypeEnum? selectionType; + final SelectionTypeEnum? selectionType; // final List countryList; // final Function(Country)? onCountryChange; TextInputWidget({ - Key? key, + super.key, required this.labelText, required this.hintText, this.controller, @@ -63,7 +63,7 @@ class TextInputWidget extends StatelessWidget { this.selectionType, // this.countryList = const [], // this.onCountryChange, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/pubspec.yaml b/pubspec.yaml index 7f13a06..7b27343 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,10 +33,10 @@ dependencies: provider: ^6.1.5+1 get_it: ^8.2.0 just_audio: ^0.10.4 -# flutter_callkit_incoming: -# git: -# url: https://github.com/hiennguyen92/flutter_callkit_incoming.git -# ref: dev + # flutter_callkit_incoming: + # git: + # url: https://github.com/hiennguyen92/flutter_callkit_incoming.git + # ref: dev url_launcher: ^6.3.2 logger: ^2.6.1 lottie: ^3.3.1 @@ -93,24 +93,24 @@ flutter: fonts: - family: Poppins fonts: -# - asset: assets/fonts/poppins/Poppins-Black.ttf -# weight: 900 -# - asset: assets/fonts/poppins/Poppins-ExtraBold.ttf -# weight: 800 -# - asset: assets/fonts/poppins/Poppins-Bold.ttf -# weight: 700 + # - asset: assets/fonts/poppins/Poppins-Black.ttf + # weight: 900 + # - asset: assets/fonts/poppins/Poppins-ExtraBold.ttf + # weight: 800 + # - asset: assets/fonts/poppins/Poppins-Bold.ttf + # weight: 700 - asset: assets/fonts/poppins/Poppins-SemiBold.ttf weight: 600 - asset: assets/fonts/poppins/Poppins-Medium.ttf weight: 500 - asset: assets/fonts/poppins/Poppins-Regular.ttf weight: 400 -# - asset: assets/fonts/poppins/Poppins-Light.ttf -# weight: 300 -# - asset: assets/fonts/poppins/Poppins-ExtraLight.ttf -# weight: 200 -# - asset: assets/fonts/poppins/Poppins-Thin.ttf -# weight: 100 + # - asset: assets/fonts/poppins/Poppins-Light.ttf + # weight: 300 + # - asset: assets/fonts/poppins/Poppins-ExtraLight.ttf + # weight: 200 + # - asset: assets/fonts/poppins/Poppins-Thin.ttf + # weight: 100 - family: GESSTwo